Revenue by Customer

Who actually pays you: ledger receipts on income accounts grouped by customer - monthly columns, totals, and each customer's share of revenue. Concentration risk in one table. Live from QuickBooks.

4 steps · shared by Klajdi · August 30, 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 · VARCHAR<one column per month, YYYY-MM> · DOUBLE
QBO_GeneralLedger.csv
account · VARCHARdate · DATEname · VARCHARmemo · VARCHARamount · 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 P&L (for income accounts)
    SELECT * FROM read_csv_auto('QBO_ProfitAndLoss_Month.csv', header=true)
  2. 02Load GL detail (last 3 months)
    SELECT * FROM read_csv_auto('QBO_GeneralLedger.csv', header=true)
  3. 03Income transactions by customer
    SELECT g.name AS customer, STRFTIME(TRY_CAST(g.date AS DATE), '%Y-%m') AS month, g.amount
    FROM input_2 g
    WHERE TRY_CAST(g.date AS DATE) IS NOT NULL AND g.account IN (SELECT account FROM input_1 WHERE section ILIKE 'income%')
  4. 04Customer x month + share of revenue
    WITH m AS (PIVOT (SELECT * FROM input_1) ON month USING SUM(amount) GROUP BY customer),
    t AS (SELECT customer, SUM(amount) AS total FROM input_1 GROUP BY customer)
    SELECT m.*, ROUND(t.total, 0) AS total,
      ROUND(100.0 * t.total / SUM(t.total) OVER (), 1) AS share_pct
    FROM m JOIN t USING (customer) ORDER BY total DESC

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 →