← Home

Worked guide

Compare federal spending without mixing periods

A worked method for monthly receipts, outlays, fiscal years, and revisions.

Start with the question and the unit

“How much did the federal government spend?” needs a period and a measure. Treasury outlays describe government-wide spending flows. They do not describe individual contracts, obligations, or medicine spending. Dollar amounts in our examples are nominal, so changes include price changes.

Keep calendar and fiscal years separate

The US federal fiscal year begins in October. October 2024 belongs to fiscal year 2025. Compare like-for-like periods: January–August with January–August, or a complete fiscal year with another complete fiscal year. Never treat a partial year as a full-year decline.

Preserve the revision you used

Keep the original file, its SHA-256 checksum, the download date, and each row’s source report date. Treasury reports can revise earlier observations. A later download may contain a different estimate for the same month. Exclude headings and year-to-date totals before summing monthly rows.

Calculate with decimal arithmetic

Given an export with year, period, and outlays_usd columns, this Python example compares complete calendar years and refuses incomplete ones. It reads a local file only.

import csv
from decimal import Decimal
with open("federal-spending.csv", newline="") as source:
    rows = list(csv.DictReader(source))
totals = {}
for year in (2024, 2025):
    selected = [r for r in rows if int(r["year"]) == year]
    expected = {f"{year}-{m:02}" for m in range(1, 13)}
    assert len(selected) == 12 and {r["period"] for r in selected} == expected
    totals[year] = sum((Decimal(r["outlays_usd"]) for r in selected), Decimal(0))
print("Nominal growth (%):", (totals[2025] / totals[2024] - 1) * 100)

Check before sharing

Source: US Treasury’s spending guide.