DEV Community

Eqvero
Eqvero

Posted on

A Currency Mismatch Can Turn Cash Flow Margin Into a False Percentage

A cash flow margin can look correct while combining revenue in US dollars with cash flow in euros. The division still produces a number, and a dashboard will happily plot it. The mistake appears when the two values are pulled from separate unit buckets and joined only by company and period.

SEC company facts group values under units such as USD, EUR, and shares. The SEC API documentation describes the company facts response and its units. Keep that unit attached to each observation all the way through a calculation. A currency code belongs in the join condition, not just in a label added after the division.

A small example

Suppose a fictional company reports operating cash flow of 120 USD and revenue of 300 EUR for the same annual period. Dividing 120 by 300 gives 40%. That percentage has no defined meaning until both values use the same currency. If the cash flow figure is also available as 120 USD and revenue as 400 USD for the same scope and period, the USD margin is 30%.

The figures here are invented to make the failure easy to reproduce. They are not exchange rates or a real filing. A single company facts response can contain observations in different unit buckets across time. The presence of a bucket alone does not prove that it contains the period, filing, or scope needed for a calculation.

Select first, calculate second

The following Python example assumes that an upstream step has already selected the intended company, concept, period, scope and filing for each candidate. It does not pick the latest SEC observation or resolve duplicate facts. The selector requires exactly one candidate in the requested unit. Multiple candidates need further investigation, while an absent unit stays missing.

from decimal import Decimal


def select_unit(candidates, unit):
    matches = [row for row in candidates if row["unit"] == unit]
    if not matches:
        return {"status": "missing", "unit": unit}
    if len(matches) != 1:
        return {"status": "ambiguous", "unit": unit}
    return {"status": "ok", **matches[0]}


def margin(cash_flow, revenue):
    if cash_flow["status"] != "ok" or revenue["status"] != "ok":
        return {"status": "input_unavailable"}
    if cash_flow["unit"] != revenue["unit"]:
        return {"status": "unit_mismatch"}
    if revenue["value"] == 0:
        return {"status": "zero_denominator"}
    return {
        "status": "ok",
        "value": cash_flow["value"] / revenue["value"],
        "unit": cash_flow["unit"],
        "sources": [cash_flow["accession"], revenue["accession"]],
    }


cf = [{"unit": "USD", "value": Decimal("120"), "accession": "cf-filing"}]
revenue = [
    {"unit": "EUR", "value": Decimal("300"), "accession": "rev-eur-filing"},
    {"unit": "USD", "value": Decimal("400"), "accession": "rev-usd-filing"},
]

result = margin(select_unit(cf, "USD"), select_unit(revenue, "USD"))
assert result["value"] == Decimal("0.3")
assert margin(select_unit(cf, "USD"), select_unit(revenue, "EUR"))["status"] == "unit_mismatch"
assert select_unit(cf, "EUR")["status"] == "missing"
assert select_unit(cf + cf, "USD")["status"] == "ambiguous"
Enter fullscreen mode Exit fullscreen mode

An accession string in this example is a placeholder. In a real pipeline, store the actual accession, concept, start and end dates, unit and filing date for each input. The period and scope checks need to happen before this function runs. Equal units do not make a year-to-date cash flow comparable to a three-month revenue figure, and a segment figure may not match a consolidated one.

If revenue is negative, the division is mathematically defined but may be misleading as a performance measure. Choose an explicit policy for that case instead of silently treating the result as an ordinary margin. A reported zero is different from an absent observation; the example returns a separate state for a zero denominator.

When conversion is necessary

If no comparable same-currency figures exist, retain the original values and make conversion a separate operation. Record the exchange-rate source, rate date or averaging period, conversion method, and resulting currency. Revenue and operating cash flow are duration measures, so a single closing rate should not be applied automatically merely because it is easy to obtain. The appropriate translation depends on the reporting context and the purpose of the analysis.

For a point-in-time dataset, use only the observations and rates available by the cutoff chosen for the analysis. A later filing can contain a revised comparative value; its accession and availability date should remain visible instead of silently overwriting the earlier input.

This extends the earlier discussion of unit mismatches in filing ratios: missing, ambiguous and incompatible values deserve separate states, rather than a plausible-looking percentage.

Top comments (0)