DEV Community

Eqvero
Eqvero

Posted on

The Million-Dollar Unit Trap in SEC Filing Ratios

A revenue-per-share calculation can be wrong by a factor of a million while both inputs look plausible. A filing table labels revenue in millions, but its share count in thousands. Dividing the displayed numbers directly gives 25 when the actual ratio is $25,000 per share for this synthetic example: $50 million divided by 2,000 shares. Change the share label to millions and the same displayed inputs instead yield $25 per share.

The table header is part of the data. When pulling tagged facts, keep the unit supplied with each fact as well. The SEC's XBRL API documentation describes unit-specific fact arrays and notes that the frames API selects facts that most closely fit a requested calendar period. A unit match alone does not make two facts comparable: their entity, period and accounting meaning must also match.

Preserve the unit before calculating

Consider a synthetic filing table:

Line Displayed value Table unit Normalized value
Revenue 50 USD millions 50,000,000 USD
Shares 2 shares thousands 2,000 shares

A parser that discards the headers calculates 50 / 2 = 25 and misses the factor of 1,000 between the scales. If it treats the share figure as two million, it gets 25 USD per share, also the wrong answer for this example. The normalized result is 25,000 USD per share. These numbers are intentionally small and made up to expose the scaling error, not describe a company.

For a tagged SEC companyfacts response, start with the unit key that contains the fact. A monetary array can be under USD, a share count under shares, and a per-share fact under a unit such as USD/shares. Do not multiply a companyfacts value again just because a rendered statement says its table is in millions. The tagged value and the rendered table have different representations; compare both against the filing when building an adapter.

Here's a small normalization function for values extracted from a rendered table. It takes the scale explicitly and uses Decimal to avoid introducing a binary floating-point rounding step:

from decimal import Decimal

SCALES = {
    "ones": Decimal("1"),
    "thousands": Decimal("1000"),
    "millions": Decimal("1000000"),
}


def normalize_table_value(displayed: str, scale: str) -> Decimal:
    return Decimal(displayed.replace(",", "")) * SCALES[scale]


revenue = normalize_table_value("50", "millions")
shares = normalize_table_value("2", "thousands")
ratio = revenue / shares
assert ratio == Decimal("25000")
print(ratio)  # 25000
Enter fullscreen mode Exit fullscreen mode

This helper expects a plain numeric string and an already identified scale. Parentheses for negative amounts, currency symbols, footnote markers and missing cells need handling before this step. Keep the original cell and header alongside the normalized number so a reviewer can reproduce the conversion.

A share count needs a period too

Even with correct units, a ratio can mix incompatible denominators. Shares outstanding at the balance-sheet date are an instant fact. Weighted-average shares describe a duration and are used in reported earnings per share. Dividing annual revenue by year-end shares can be a useful custom metric if it is labeled that way; it is not the company's reported EPS.

For reported EPS, inspect the numerator and denominator in the filing's EPS note. Basic and diluted EPS use different share denominators, and the applicable earnings numerator may also differ. Stock splits and comparative adjustments can change historical per-share figures. Avoid comparing a newly adjusted denominator with a stale numerator or presentation without checking the filing.

A useful record for a derived ratio includes the entity, concept names, start and end dates, unit, values, accession numbers, and a label explaining the formula. For the example above, retain both source cells and their table scales. If the source is companyfacts, retain the exact unit keys and filing accessions instead. These fields let a downstream chart distinguish a duration-based ratio from an instant-based one and make mismatches visible before aggregation.

Test the boundary

Put at least these cases in the adapter's tests:

  • A millions-versus-thousands table produces 25,000, not 25, for the synthetic input above.
  • A zero or missing share count is rejected or returned as missing; it never becomes an infinite ratio or zero by default.
  • USD and a different currency do not silently merge. Currency conversion requires a separately sourced rate and date.
  • An annual numerator cannot silently join a quarterly weighted-average denominator. An instant denominator must be explicitly labeled as such.

Rounding can still leave a small difference when comparing a calculated ratio with a printed figure. Preserve precision during calculation and round for presentation. If the difference is material, check the scale, period, numerator definition and original filing before attributing it to rounding.

For the related date-alignment problem, see SEC XBRL Frames Can Mix Fiscal Quarters. For quarter versus year-to-date flows, see normalizing discrete and YTD durations.

Top comments (0)