Expenses vs Inflation (QuickBooks × FRED CPI)

Joins your QuickBooks expenses to the official CPI series from FRED — real, inflation-adjusted spend vs nominal, indexed to 100. A live cross-source join that refreshes with your books.

5 steps · August 4, 2026
Make it your own →
No data is shared in this template. It contains only the recipe — column names and SQL logic. When you run it, your data is processed in your own browser and never leaves your machine.

What data it expects

QBO_ProfitAndLoss_Month.csv
section · VARCHARaccount · VARCHAR2025-08 · DOUBLE2025-09 · DOUBLE2025-10 · DOUBLE2025-11 · DOUBLE2025-12 · DOUBLE2026-01 · DOUBLE2026-02 · DOUBLE2026-03 · DOUBLE2026-04 · DOUBLE2026-05 · DOUBLE2026-06 · DOUBLE2026-07 · DOUBLETotal · DOUBLE
FRED_CPIAUCSL.csv
date · DATEcpiaucsl_idx · DOUBLE

Connect QuickBooks Online or drop a CSV / Excel export with a similar layout — the AI adapts the workflow if your columns differ.

How it works — every step, readable

  1. 01Load QuickBooks Monthly P&L
    SELECT * FROM read_csv_auto('QBO_ProfitAndLoss_Month.csv', header=true)
  2. 02Load CPI and Key by Year-Month
    SELECT
      strftime(CAST("date" AS DATE), '%Y-%m') AS period,
      CAST("date" AS DATE) AS cpi_date,
      cpiaucsl_idx AS cpi
    FROM read_csv_auto('FRED_CPIAUCSL.csv', header=true)
    WHERE cpiaucsl_idx IS NOT NULL
  3. 03Unpivot P&L and Compute Total Expenses by Month
    WITH unpivoted AS (
      UNPIVOT input_1
      ON COLUMNS(* EXCLUDE (section, account, Total))
      INTO NAME period VALUE raw_amount
    ), cleaned AS (
      SELECT
        period,
        section,
        account,
        COALESCE(TRY_CAST(REPLACE(CAST(raw_amount AS VARCHAR), ',', '') AS DOUBLE), 0) AS amount
      FROM unpivoted
      WHERE period <> 'Total'
        AND account NOT ILIKE '%total%'
    )
    SELECT
      period,
      ROUND(SUM(CASE
        WHEN section IN ('Cost of Goods Sold', 'Expenses') THEN amount
        ELSE 0
      END), 2) AS nominal_expenses
    FROM cleaned
    GROUP BY period
    ORDER BY period
  4. 04Join Expenses to CPI and Compute Real Expenses
    WITH joined AS (
      SELECT
        e.period,
        e.nominal_expenses,
        c.cpi
      FROM input_1 e
      INNER JOIN input_2 c
        ON e.period = c.period
    ), latest_cpi AS (
      SELECT cpi AS latest_cpi
      FROM joined
      WHERE cpi IS NOT NULL
      ORDER BY period DESC
      LIMIT 1
    ), first_cpi AS (
      SELECT cpi AS first_cpi
      FROM joined
      WHERE cpi IS NOT NULL
      ORDER BY period ASC
      LIMIT 1
    )
    SELECT
      j.period,
      j.nominal_expenses,
      ROUND(j.nominal_expenses * l.latest_cpi / NULLIF(j.cpi, 0), 2) AS real_expenses_latest_month_dollars,
      j.cpi,
      ROUND(j.cpi / NULLIF(f.first_cpi, 0) * 100, 2) AS cpi_index_first_month_100
    FROM joined j
    CROSS JOIN latest_cpi l
    CROSS JOIN first_cpi f
    ORDER BY j.period
  5. 05Final: Nominal vs Real Expenses with CPI Index
    SELECT
      period AS month,
      nominal_expenses,
      real_expenses_latest_month_dollars AS real_expenses,
      cpi_index_first_month_100 AS cpi_index
    FROM input_1
    ORDER BY month

Run this on your books

Free to try — no sign-up, no card. The workflow runs in your browser; your data never leaves your machine.

Make it your own →