Docs menuexpand_more
travel_exploreTry in the API Viewer

Guides

Reference

Other pages

Endpoints

search
appsAll APIs
functionHow metrics are calculated

Cookbook · Applied · Hands-on 6

Calculate year-over-year growth from financial statements without fooling yourself

Compute YoY from annual and quarterly income statements: match the same period a year earlier, skip incomparable pairs, handle loss-making bases, and report margins in points.
For developersFor companies7 min read
open_in_newIllustrated series on Qiita (Japanese)The same topic is also published as an illustrated series on Qiita.

Endpoints used

Year-over-year (YoY) change is just a subtraction and a division. But if you don't first check whether the row a year back is actually comparable, you get numbers that look reasonable and mean nothing. This page turns the "when to compute YoY and when not to" rules into code, using the ZENITH Code income statement endpoint.

  • Find the prior period by "same fiscal month, one year earlier," not "the next row down."
  • When accounting standard, consolidation scope, or period length differ, return a reason instead of a rate.
  • Don't compute a growth rate when the prior value is zero or negative. Report margin changes in percentage points, not as a growth rate.

The examples use Toyota Motor (7203) annual figures, retrieved from the production API on October 27, 2026 at 16:50 JST.

We at Crabgrass Inc. build ZENITH Code, an API for financial and disclosure data on Japanese companies. This article is an implementation guide for using our own data.

Five checks before you compute YoY

YoY only means something when both periods were measured the same way. If any of these differ, part of the change has nothing to do with business performance.

Check What goes wrong if it fails
Exactly one year earlier If a period is missing in between, you read two years of change as one
Same period type Comparing a full year with a quarter, or Q1 with Q2, compares different lengths
Same period length A 9- or 15-month transition period after a fiscal year-end change shows up as growth or decline
Same accounting standard The year a company moves from Japanese GAAP to IFRS, revenue and operating income are defined differently
Same consolidation basis Consolidated vs. standalone covers a different set of companies

ZENITH Code returns the fields you need for each check:

Field Meaning
fiscalPeriod Fiscal period end month (YYYY-MM). The fiscal year ended March 2025 is 2025-03
period FY (full year), Q1, Q2, Q3. Profit and loss for Q2 and Q3 is cumulative from the start of the fiscal year
fiscalPeriodDays Length of the period in days. About 365 for a 12-month year, about 182 for a J-REIT's six-month period
accountingStandard Accounting standard. Field names are the same regardless of standard
consolidation consolidated or nonconsolidated (standalone). null when unknown

Find the same period a year earlier

A common mistake is to take "the next row" as the prior period. The API returns periods newest first, but the next row isn't always one year back.

  • If a period is missing, the next row is two years back.
  • J-REITs have two full-year (FY) rows per year, so the next row is six months back.
  • After a fiscal year-end change, the next row isn't a 12-month period.

Instead, subtract one from the year in fiscalPeriod and look for a row with the same month and the same period.

def same_period_last_year(rows, current):
    """Find the row of the same type (FY, Q1-Q3) with the same month one year earlier, or None."""
    year, month = current["fiscalPeriod"].split("-")
    target = f"{int(year) - 1}-{month}"
    for row in rows:
        if row["fiscalPeriod"] == target and row["period"] == current["period"]:
            return row
    return None

The same function works for quarters. Q2 of the fiscal year ending March 2026 (2025-09, Q2) is compared with Q2 of the prior year (2024-09, Q2). Both are year-to-date cumulative, so the result is a same-quarter-last-year comparison.

Decide whether a pair is comparable

Next, decide whether the two periods can be compared. If not, return a reason code.

def comparable(current, previous):
    """Return None if the pair is comparable, otherwise a reason code."""
    if previous is None:
        return "no_previous"
    std_now = (current.get("accountingStandard") or "").lower()
    std_prev = (previous.get("accountingStandard") or "").lower()
    if not std_now or std_now != std_prev:
        return "standard_changed"
    cons_now, cons_prev = current.get("consolidation"), previous.get("consolidation")
    if cons_now and cons_prev and cons_now != cons_prev:
        return "consolidation_changed"
    days_now, days_prev = current.get("fiscalPeriodDays"), previous.get("fiscalPeriodDays")
    if days_now is None or days_prev is None:
        return "length_unknown"
    if abs(days_now - days_prev) > 3:
        return "length_differs"
    return None

The reasoning behind each rule:

  • Compare accounting standards case-insensitively. The sample responses in our docs return lowercase values such as ifrs. Don't flag a "change" because of letter case.
  • Compare consolidation only when both are known. null means "unknown." If one side is null, this code still computes the change. Add null to the stop condition if you want to be strict.
  • Allow up to three days of difference in length. A 12-month year can be 364 to 366 days depending on leap years and counting. In our docs' sample response (retrieved October 23, 2026), Toyota's fiscal year ended March 2025 is 364 days and the year ended March 2024 is 365. Requiring exactly 365 would throw out comparable years.
  • Stop when length is unknown. If fiscalPeriodDays is null, you can't confirm the two periods are the same length.

The rule compares the two lengths with each other instead of requiring 12 months, so two J-REIT half-year periods (about 182 days each) still compare. If you only want annual comparisons, also require 360 to 367 days.

Separate growth rates from point changes

For comparable pairs, compute the value: a growth rate for amounts, a point difference for margins.

RATIO_FIELDS = {"grossMargin", "operatingMargin", "ordinaryMargin", "netMargin"}


def change(current, previous, field):
    """Return (value, reason). Ratios give a point difference; amounts give a growth rate."""
    reason = comparable(current, previous)
    if reason:
        return None, reason
    a, b = current.get(field), previous.get(field)
    if a is None or b is None:
        return None, current.get("nullReason") or previous.get("nullReason") or "missing_value"
    if field in RATIO_FIELDS:
        return a - b, None
    if b <= 0:
        return None, "previous_not_positive"
    return a / b - 1, None

Skip growth rates on a zero or negative base

If the prior period had an operating loss, the growth rate flips sign. Going from −¥420 million to +¥610 million gives −245% by formula. Performance improved, but the number reads as a decline. A prior value of exactly zero can't be divided at all.

In these cases, return "prior period zero or negative" instead of a rate. Showing the two amounts side by side is clearer for the reader.

Report margins in points

When operating margin goes from 11.87% to 9.98%, the change is −1.89 percentage points. Expressed as a growth rate it's −15.9%, a different number. To avoid mixing them, ratio fields use subtraction only.

API ratios are decimals between 0 and 1, so the difference is a decimal too. Multiply by 100 and add "pt" on screen: −0.0189 in the API, −1.89 pt on screen.

Build a YoY table for every period

Combine the functions to get YoY for all periods.

def yoy_table(rows, fields=("revenue", "operatingIncome", "operatingMargin")):
    """List YoY values and reasons for each field, newest period first."""
    table = []
    for current in sorted(rows, key=lambda r: r["fiscalPeriod"], reverse=True):
        previous = same_period_last_year(rows, current)
        entry = {"fiscalPeriod": current["fiscalPeriod"], "period": current["period"]}
        for field in fields:
            entry[field] = change(current, previous, field)
        table.append(entry)
    return table

With limit=5 you get five years, but the oldest has nothing to compare with, so you get four YoY values. For N years of YoY, request limit = N+1. The default limit is 10 and the maximum is 40.

For Toyota's fiscal year ended March 2025, the output is:

2025-03 FY revenue          (0.06522580777497455, None)
2025-03 FY operatingIncome  (-0.10412009563353486, None)
2025-03 FY operatingMargin  (-0.018870933445311433, None)
Item FY ended March 2024 FY ended March 2025 YoY
Revenue ¥45.10 trillion ¥48.04 trillion +6.52%
Operating income ¥5.35 trillion ¥4.80 trillion −10.41%
Operating margin 11.87% 9.98% −1.89 pt

YoY is computed from the raw yen values. Recomputing from the rounded ¥5.35 trillion and ¥4.80 trillion gives −10.28%, off by 0.13 points. Calculate with raw values and round only for display.

Format it for the screen

Turn the value and reason into text in one function. Intl.NumberFormat with signDisplay: "exceptZero" adds a + to positive numbers.

const REASON_TEXT = {
  no_previous: "no data for the same period last year",
  standard_changed: "different accounting standard",
  consolidation_changed: "consolidated vs. standalone",
  length_differs: "different period length",
  length_unknown: "period length unknown",
  missing_value: "value not available",
  previous_not_positive: "prior period zero or negative",
  non_jpy_material: "reported in a currency other than yen",
};

const pct = new Intl.NumberFormat("en-US", { style: "percent", minimumFractionDigits: 1, maximumFractionDigits: 1, signDisplay: "exceptZero" });
const pt = new Intl.NumberFormat("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2, signDisplay: "exceptZero" });

function formatChange([value, reason], isRatio) {
  if (value === null) return `n/a (${REASON_TEXT[reason] ?? reason})`;
  return isRatio ? `${pt.format(value * 100)} pt` : pct.format(value);
}

Don't stop at "n/a"; show the reason. Readers can tell missing data from a fiscal year-end change, and the reason tells them what to look up in the earnings summary or securities report.

Comparing two companies on the same period

The same logic applies across companies:

  • Line up only periods with the same fiscalPeriod and period. A March year-end company and a December year-end company cover different months even when both say "fiscal 2026."
  • Show the accounting standard and period length on screen, and mark any difference.
  • Matching fields and conditions are only the minimum. Different industries or business mixes give the same operating margin a different meaning.

See Compare revenue and operating margin of two companies for more.

Read the numbers carefully

  • J-REITs have two full-year rows per year. fiscalPeriodDays is about 182. Comparing with the next row compares with six months earlier.
  • Q2 and Q3 are cumulative. Compare like with like (Q2 with Q2). For a single three-month quarter, take the difference between cumulative figures. See Cumulative quarters and TTM.
  • Changes in consolidation scope don't show in the flag. A share exchange or a change in the scope of consolidation can break continuity without changing consolidation. Check disclosures for years with large acquisitions.
  • The year a company first acquires a subsidiary at year-end, profit and loss is standalone. The income statement row is nonconsolidated while the balance sheet row for the same period is consolidated. If the flag differs from the prior year, the code above stops.
  • Newly listed companies may lack pre-listing income statements. The first earnings summary after listing often doesn't include the prior full-year P&L. You'll get "no data for the same period last year."
  • Non-yen periods have null amounts. Companies that report in US dollars (6269 and 9399) return nullReason of non_jpy_material. The code above passes that reason through.
  • Prior-period values can change later. Corrections, or replacing earnings-summary figures with securities-report figures, can update the prior year. If a stored YoY no longer matches, check the filing IDs of both periods. See Track the source of every financial figure.

Summary

  • Find the prior period by subtracting one year from fiscalPeriod, matching the month and period.
  • Return a reason instead of a rate when accounting standard, consolidation, or period length differ.
  • Skip growth rates on a zero or negative base, and report margins in points.
  • Compute from raw yen values and round only for display.

Related

A Japanese-language walkthrough with screenshots is on Qiita.

Before you read the numbers

Points about the endpoints in this article that are easy to misread as wrong data.

  • By designTDnet-derived information is returned 24 hours after disclosure

    Under Article 7(1) of the JPX TDnet API service terms, information derived from TDnet (timely disclosures) is returned by the API and MCP 24 hours after the disclosure time (from 2026-11-13). Within 24 hours, rows of timely disclosures, dividends, dividend changes, splits, delisting schedules, earnings-release periods and earnings forecasts are left out, and TDnet PDFs (filing-document) return 403 tdnet_embargo with the time they become available (availableAt). Latest values (quote, key-metrics-latest, screener and so on) have no previous value to fall back to, so for stocks with a TDnet document in the last 24 hours the fields computed from documents (PER, PBR, dividend yield, market cap and so on) are null; prices and price changes are unaffected. The response headers X-TDnet-Embargoed-Count, X-TDnet-Embargoed-Symbols and X-TDnet-Embargo-Next-Release tell what was held back and when it becomes available. The boundary is disclosure time + 24 hours <= response time, compared in absolute time rather than Japan time. For shareholder benefits and dividend policies, versions sourced from TDnet are held back for 24 hours and the previous version is returned when there is one (versions from EDINET or company IR pages are not affected). Rows whose TDnet disclosure time is unknown are not returned. Calls whose whole content is held back (a list that is empty only because of this rule, or a single stock whose affected latest fields are all null) do not use tokens; calls where only part is held back do. EDINET filings (annual, extraordinary and large-holding reports) and stock prices are not affected.

    Endpoints:/disclosures/events-feed/filing-document/dividend-changes/dividends/dividends-calendar/dividends-bulk/dividend-streaks/splits/delisting-schedule/income-statement/balance-sheet-statement/cash-flow-statement/key-metrics/income-statement-short/balance-sheet-statement-short/cash-flow-statement-short/key-metrics-short/key-metrics-bulk/financial-statement-full/earnings-forecast/sga-breakdown/valuation-history/market-cap-history/quote/key-metrics-latest/batch-quote/batch-key-metrics-latest/market-capitalization/profile/screener/rankings/peers/screener-presets/industry-benchmarks/shareholder-benefits/shareholder-benefits-list/dividend-policy/dividend-policies

  • By designTOKYO PRO Market companies have no financials

    TOKYO PRO Market (the market for professional investors) companies file no XBRL results, so their financials are not ingested; statements and the metrics and market capitalization calculated from financials or share counts are empty or null. Describe them as "financials not covered", not as missing data. Market-wide aggregates (rankings, market-breadth and so on) also exclude this market by default.

    Endpoints:/income-statement/balance-sheet-statement/cash-flow-statement/income-statement-short/balance-sheet-statement-short/cash-flow-statement-short/financial-statement-full/key-metrics/key-metrics-short/key-metrics-latest/market-capitalization/market-cap-history/valuation-history/profile

  • By designRight after listing, prior-year income and ratios can be empty

    The first earnings release after listing does not include full-year income for the prior year, so for newly listed companies the pre-listing income statement is empty and the prior-year row has only total assets and net assets. Before the first results, market cap and PER/PBR history are empty too. Describe it as "income before listing not covered".

    Endpoints:/income-statement/income-statement-short/valuation-history/market-cap-history/key-metrics-short

  • By designQuarterly income figures are year to date

    Q2 and Q3 income and cash-flow figures are cumulative from the start of the fiscal year. Listing them as single-quarter revenue makes Q3 look large. Subtract the previous quarter's cumulative value to get a single quarter, and use key-metrics for trailing-twelve-month (TTM) values.

    Endpoints:/income-statement/cash-flow-statement/income-statement-short/cash-flow-statement-short/key-metrics

  • By designPeriods before and after a switch from consolidated to standalone do not connect

    Each statement period carries a consolidation flag (consolidated or nonconsolidated). For companies that moved from consolidated to standalone reporting, or that became a different business through a share exchange, the reporting scope changes at that point, so prior-period-end values and growth rates do not connect across it. Align consolidation before comparing across periods.

    Endpoints:/income-statement/balance-sheet-statement/cash-flow-statement/income-statement-short/balance-sheet-statement-short/cash-flow-statement-short/financial-statement-full

  • By designJPY amounts and missing-field reasons in foreign-currency statements

    reportedCurrency identifies the statement currency. Available JPY amounts are returned. nullReasons identifies missing fields, including non_jpy_material for unavailable JPY amounts and source_missing:operating_income when the statement lacks operating income used for the margin. Foreign-currency rows without any JPY amount retain nullReason = non_jpy_material.

    Endpoints:/income-statement/balance-sheet-statement/cash-flow-statement

  • By designGross profit scope differs for companies with other operating revenue

    For companies that report operating revenue (such as retailers), revenue = net sales (netSales) + other operating revenue (otherOperatingRevenue), and whether grossProfit includes the latter depends on the company (grossProfitIncludesOtherOperatingRevenue). Use operatingGrossProfit (or grossProfit when it is null) to compare companies. Adding other operating revenue to grossProfit before subtracting SG&A can count it twice.

    Endpoints:/income-statement/income-statement-short/financial-statement-full

  • By designFor annual reports with both Japanese GAAP and IFRS statements, financial-facts and the statements can look different

    For companies whose annual report includes both Japanese GAAP and IFRS statements (2130, 436A, 4494, 6532 and others), the summary of business results in financial-facts comes from the Japanese GAAP tables, while balance-sheet-statement and the other statement endpoints use the IFRS tables the company has adopted, so totals such as total assets can look different. Both are as filed. accountingStandard in financial-facts is the standard declared for the whole document, so rows with Japanese GAAP tags also show IFRS. Check which table a value comes from by its tag name, not by accountingStandard. A trailing _notes in a tag name is added when ZENITH ingests the data and is not part of the original tag.

    Endpoints:/financial-facts/balance-sheet-statement/income-statement/cash-flow-statement

  • Easy to misreadOperating income is not always gross profit minus SG&A

    Under Japanese GAAP, operating income = (operatingGrossProfit ?? grossProfit) − SG&A − (otherOperatingExpenses ?? 0). For companies with other operating revenue or with operating-expense lines besides SG&A, computing only grossProfit − SG&A does not match and looks like an error. Use this formula when you check the numbers.

    Endpoints:/income-statement/income-statement-short/financial-statement-full

  • Easy to misreadEPS can be negative even with positive net income

    Companies that deduct dividends on class shares when computing common-share EPS can show negative EPS even with positive net income, as in their earnings releases (7412 and 8836). A sign difference between net income and EPS is not an error by itself.

    Endpoints:/income-statement/key-metrics

  • Easy to misreadactualEps and estimateEps in earnings-calendar are for the quarter alone, not year to date or full year

    actualEps (reported) and estimateEps (estimate) in earnings-calendar are both earnings per share (yen) for that quarter alone (three months). Rows whose fiscalPeriod is FY also cover only the fourth quarter, not the full year. estimateEps is the market consensus, not the company forecast. Quarterly EPS in income-statement is cumulative from the start of the fiscal year, so the values differ (for 6230 in Q2, actualEps is 21.16 and the year-to-date figure is 38.27). Use the same basis, single quarter or year to date and full year, when you compare. Values are null for rows before the announcement, for reported rows whose results are not in yet, and for issues or periods without an estimate.

    Endpoints:/earnings-calendar/income-statement/income-statement-short

  • FixedStandalone income for periods with a first subsidiary at year end is back

    When a company acquired its first subsidiary at year end, the annual report had a consolidated balance sheet only and standalone income and cash-flow statements only, and those periods were missing entirely from the annual income and cash-flow data (12 periods, including 5572, 9262, 7370 and 3370). Those periods now return income and cash flow flagged consolidation: nonconsolidated, while the same period's balance sheet is consolidated. Mind the flag when comparing with adjacent periods.

    Fixed in: version 79 and data platform #3177 (2026-11-03)Endpoints:/income-statement/cash-flow-statement/income-statement-short/cash-flow-statement-short

  • FixedPeriods with no values are no longer returned

    Previously, rows for periods with every value null and no source could be returned (some cash-flow periods for 648A and 624A, for example). Since version 48, periods with no values are not returned (except non-yen periods, which come with nullReason). An all-null row in an older response does not mean results existed for that period.

    Fixed in: version 48 (2026-11-02)Endpoints:/income-statement/balance-sheet-statement/cash-flow-statement/income-statement-short/balance-sheet-statement-short/cash-flow-statement-short/financial-statement-full

visibility_off
The screens and numbers in these articles leave out stock prices and metrics calculated from them. Before showing live data on your own screens, check what you may display. What you can display
gavel

Disclaimer

This page explains how to use a Japanese equity data API and how its data is defined. It is not a solicitation to invest or a recommendation to buy or sell any security. The content reflects information at the time of writing and is not guaranteed to be accurate or complete. Investment decisions are your own responsibility.

What you may show or provide to third parties depends on your plan and Article 8 of the Terms. Exchange data such as stock prices may not be shown to third parties on any plan. Edited or processed information from which the original stock prices or similar market data can be readily reconstructed is treated as exchange data and may not be displayed or redistributed to third parties. No plan or separate agreement with us overrides this restriction. Terms, Article 8 · Data sources and terms of use