HB
Back to projects

Financial Metrics: Building a Reconciled Company Performance Mart

Published September 2026
Engineeringanalytics engineering

financial metrics · SEC data · dimensional modeling · data quality

Project snapshot

  • Built: Built a filing-aware annual metric mart that retains period, unit, tag, and filing context.
  • Stack: Python, DuckDB, dbt, SQL, pytest
  • Result: From FY2023 to FY2025, reported revenue rose from $211.9B to $281.7B and net margin from 34.1% to 36.1%.
  • Recommendation: Use approved metric definitions and period/unit rules, retain filing identity, and reconcile selected annual values before dashboarding.
  • Code: dbt models and SEC loader

Business question

Finance and product leaders need a consistent view of revenue, net income, and margin. SEC filings contain multiple facts, periods, units, and amendments, so a dashboard can show a precise trend built from values that are not comparable.

The decision is whether the annual figures are consistent enough to support an executive trend view. This analysis uses Microsoft’s public filings; it does not represent an internal finance system.

Data and preparation

The source is the SEC Company Facts API. Each fact includes a tag, unit, period, filing date, and value. The selected view uses documented annual facts for Microsoft and keeps quarterly and annual facts separate.

The checks cover unit compatibility, annual period selection, duplicate fact context, margin reconciliation, and source lineage. The evidence manifest records the source hash and period rule.

Findings

Revenue and net income both rose

Chart takeaway: Microsoft reported results, FY2023–FY2025: revenue rose from $211.9 billion to $281.7 billion while net income rose from $72.4 billion to $101.8 billion
View full chart

Both measures increased across the selected fiscal years. Revenue shows scale; net income shows what remained after reported costs. Together they give a fuller performance picture than revenue alone.

Reported net margin improved slightly

Chart takeaway: Microsoft reported net margin rose from 34.1% in FY2023 to 36.1% in FY2025; the vertical scale starts at zero
View full chart

Selected net income divided by selected revenue rose from 34.1% to 36.1%. The full zero-based scale keeps that change in proportion. This company-level result does not explain which products or costs drove it.

Filing context is part of the metric

Chart takeaway: SEC Company Facts grain: each reported value retains its tag, unit, fiscal period, and filing identity for audit
View full chart

Keeping the source context makes it possible to review why each value was selected instead of relying on an undocumented spreadsheet cell.

A worked tie-out shows why filing identity stays attached

For FY2024, the selected revenue fact is $245.122 billion under RevenueFromContractWithCustomerExcludingAssessedTax, for 1 July 2023 through 30 June 2024. The same period and value appear in the FY2024, FY2025, and FY2026 10-K filings (filed 30 July 2024, 30 July 2025, and 29 July 2026). Net income is $88.136 billion in those filings, so the reconciled net margin is 35.96%. The tie-out found no value change; it confirms that repeated comparative facts should not be counted as separate periods.

Fiscal periodSelected tagValueFiling contextTreatment
FY2024 revenueRevenueFromContractWithCustomerExcludingAssessedTax$245.122BFY2024, FY2025, and FY2026 10-KsKeep one FY2024 period; retain all filing references
FY2024 net incomeNetIncomeLoss$88.136BFY2024, FY2025, and FY2026 10-KsReconcile on the same period and unit
FY2024 net marginDerived35.96%$88.136B ÷ $245.122BCalculate only after period and unit alignment

Result

The selected annual metrics show revenue rising from $211.9 billion to $281.7 billion and net income from $72.4 billion to $101.8 billion between FY2023 and FY2025; net margin rose from 34.1% to 36.1%. The evidence supports reported company-level trends, not product, customer, or causal operating conclusions.

Recommendation: publish a small finance mart with approved metric definitions, period rules, units, and source links. Store filing identity with each fact, deduplicate repeated comparative periods, and reconcile the selected annual values before connecting the mart to planning or dashboards. Alert when a later filing changes a selected historical value; extend to quarterly or operating measures only after definitions are agreed.

Data lineage and model checks

SEC Company Facts JSON
  ↓ analytics/load_sec_company_facts.py
DuckDB raw.company_facts
  ↓ dbt staging
stg_sec_company_facts
  ↓ dbt mart
mart_financial_metrics

This excerpt from analytics/models/marts/mart_financial_metrics.sql selects one filing context per fiscal year before choosing reported metrics:

with annual_facts as (
    select *
    from {{ ref('stg_sec_company_facts') }}
    where fiscal_period = 'FY'
      and unit = 'USD'
      and form in ('10-K', '10-K/A')
      and period_start is not null
      and period_end is not null
      and date_diff('day', period_start, period_end) between 300 and 380
), filing_candidates as (
    select distinct fiscal_year, accession, filed_date
    from annual_facts
), chosen_filing as (
    select fiscal_year, accession
    from (
        select
            *,
            row_number() over (partition by fiscal_year order by filed_date desc nulls last, accession desc) as filing_rank
        from filing_candidates
    ) ranked_filings
    where filing_rank = 1
)
TestProtection
stg_sec_company_facts schema testsFact ID is unique and required fields, including fiscal year, value, accession, and form, are present.
mart_financial_metrics schema testsFiscal year is unique and required; revenue and net income are present.
assert_financial_metrics_are_reconciled.sqlRevenue is positive; net income and net margin are not null.
test_sec_fact_loader_preserves_one_row_per_reported_observationThe loader preserves each reported fact row and its form.
test_sec_loader_writes_a_queryable_raw_relationLoaded facts are available in the DuckDB raw relation.

The SQL test checks positive and present values; the filing selection and FY2024 tie-out are documented in the evidence manifest. CI verifies the manifest and chart hashes but does not recalculate this full-source tie-out.

View the dbt models.

What this can't tell you

SEC facts support reported company-level trends, not product or customer drivers, causal operating results, or internal operations. Period, unit, tag, and filing choices remain part of each measure.

Read technical details

Technical appendix

The evidence manifest records the SEC source, annual period rule, validation checks, and chart hashes. No raw filing payloads or private business data are published.