Deferred Revenue Waterfall in SQL: Build One That Ties
Build a deferred revenue waterfall in SQL from one schedule table, roll it forward, and tie it to the GL, with a worked three-contract example and the queries.

Build the deferred revenue waterfall from one schedule table: one row per contract per service month. From that table, the same SQL produces the waterfall, the monthly rollforward (opening plus billings minus recognized equals closing) and a tie-out to the GL account. Any difference points to an entry that has no schedule behind it.
A deferred revenue waterfall is only useful if its closing balance equals the deferred revenue account in your general ledger. Most spreadsheet waterfalls drift a little every month. This post builds one in SQL from a contracts table, rolls it forward, and ties it to the GL with one query.
TL;DR: Build the deferred revenue waterfall from one schedule table: one row per contract per service month. From that table, the same SQL produces the waterfall, the monthly rollforward (opening plus billings minus recognized equals closing) and a tie-out to the GL account. Any difference points to an entry that has no schedule behind it.
What is a deferred revenue waterfall?
A deferred revenue waterfall is a schedule that spreads each billed but unearned contract across the future months in which its revenue will be recognized.
Read across a row and you see one contract releasing into revenue. Read down a column and you see how much revenue is already locked in for that month. Stripe describes its version simply: "The waterfall report displays information about your monthly revenue" (Stripe Docs, Revenue waterfall).
Two related terms:
- A deferred revenue rollforward is the reconciliation of one period: opening balance, plus billings, minus revenue recognized, equals closing balance.
- A tie-out is the check that the rollforward's closing balance equals the deferred revenue balance in the general ledger.
The waterfall shows where the balance is going. The rollforward and the tie-out show that the balance is right.
Why build the waterfall in SQL instead of Excel?
A spreadsheet waterfall usually starts as one tab per year, one row per contract, and a formula that divides the contract value by the term. It works until someone inserts a row, overrides a cell for a mid-term upgrade, or copies last month's tab forward with a stale range.
A SQL waterfall has three properties a spreadsheet struggles to keep:
- One source. Every number comes from the contracts table, so there is nothing to copy forward.
- Replay. Rerun the query for any past month and you get the same answer, as long as the inputs are unchanged. Our post on deterministic AI in accounting explains why replay matters to auditors.
- Reviewable logic. The recognition rule is written once, in a query a reviewer can read, not spread across thousands of cells.
The same argument applies to cash: see making your bank reconciliation replayable in SQL.
If your ERP already produces a waterfall, this is still worth doing as an independent check. Some AI-native ERPs build it in. Rillet, for example, says its product "includes both the revenue waterfall and the deferred revenue schedule" (Rillet, Revenue recognition). A query you control gives the reviewer a second path to the same number.
What does the auditor need from your deferred revenue?
Deferred revenue is a contract liability under ASC 606, and the standard asks for specific numbers about it. BDO's summary of the Topic 606 disclosures lists the requirement to "disclose opening and closing balances of receivables, contract assets and contract liabilities from contracts with customers" and to "disclose revenue recognized in the period that was included in the contract liability balance at the beginning of the period" (BDO, Topic 606 Presentation and Disclosure, Oct 2017).
Private companies get relief. Per the same BDO guide, "Non-public entities can elect to disclose only the opening and closing balances of receivables, contract assets and contract liabilities from contracts with customers." The AICPA has flagged the opening-balance disclosure as a second-year trap for private companies (AICPA and CIMA, May 2022).
Either way, the auditor will want a rollforward that ties, with the contracts behind it. A waterfall built from a schedule table gives you that, plus the "recognized from opening balance" figure if you need it. It also belongs on your year-end PBC list.
How do you build the schedule table?
Start with a contracts table: contract ID, customer, amount, billing date, service start and service end. The worked example below uses three illustrative contracts:
- C-101 Acme: $12,000 billed Oct 1, 2026; service Oct 2026 to Sep 2027.
- C-102 Birch: $6,000 billed Nov 1, 2026; service Nov 2026 to Apr 2027.
- C-103 Cobalt: $24,000 billed Sep 1, 2026; service Sep 2026 to Aug 2027.
This query writes one row per contract per service month and spreads the amount evenly. Rounding goes to the last month, so each contract sums back to its exact amount. It is written for Postgres.
-- 1. Schedule: one row per contract per service month
CREATE TABLE rev_schedule AS
WITH months AS (
SELECT c.contract_id, c.amount, c.billed_on,
CAST(gs.m AS DATE) AS rev_month,
COUNT(*) OVER (PARTITION BY c.contract_id) AS n_months,
ROW_NUMBER() OVER (PARTITION BY c.contract_id
ORDER BY gs.m) AS k
FROM contracts c
CROSS JOIN LATERAL generate_series(
date_trunc('month', c.service_start),
date_trunc('month', c.service_end),
INTERVAL '1 month') AS gs(m)
)
SELECT contract_id, billed_on, rev_month,
CASE WHEN k < n_months
THEN ROUND(amount / n_months, 2)
ELSE amount - ROUND(amount / n_months, 2) * (n_months - 1)
END AS rev_amount
FROM months;
Ratable recognition means spreading revenue evenly over the service period. This example uses whole months. If contracts start mid-month, choose a daily or mid-month convention, write it into your revenue policy and apply it in this one query.
Want every deferred revenue balance to come with the contract rows, the rule and the SQL behind it? Join the Yoraito waitlist for early access.
How do you roll it forward and tie it to the GL?
The rollforward is a set of filters on the same schedule table. For November 2026:
-- 2. Rollforward for November 2026, from the schedule alone
SELECT
SUM(CASE WHEN billed_on < DATE '2026-11-01'
AND rev_month >= DATE '2026-11-01' THEN rev_amount ELSE 0 END) AS opening,
SUM(CASE WHEN billed_on >= DATE '2026-11-01'
AND billed_on < DATE '2026-12-01' THEN rev_amount ELSE 0 END) AS billings,
SUM(CASE WHEN rev_month = DATE '2026-11-01'
AND billed_on < DATE '2026-12-01' THEN rev_amount ELSE 0 END) AS recognized,
SUM(CASE WHEN rev_month = DATE '2026-11-01'
AND billed_on < DATE '2026-11-01' THEN rev_amount ELSE 0 END) AS recognized_from_opening,
SUM(CASE WHEN billed_on < DATE '2026-12-01'
AND rev_month >= DATE '2026-12-01' THEN rev_amount ELSE 0 END) AS closing
FROM rev_schedule;
Then compare the closing balance to the GL:
-- 3. Tie-out: schedule closing balance vs GL account 2400
SELECT g.balance AS gl_balance,
s.closing AS schedule_closing,
g.balance - s.closing AS difference
FROM gl_balances g
CROSS JOIN (
SELECT SUM(rev_amount) AS closing
FROM rev_schedule
WHERE billed_on < DATE '2026-12-01'
AND rev_month >= DATE '2026-12-01') s
WHERE g.account = '2400'
AND g.period = '2026-11';

- Opening balance, Nov 1: $31,000 (C-101 $11,000; C-103 $20,000).
- Plus billings in November: $6,000 (C-102).
- Minus revenue recognized in November: $4,000 (C-101 $1,000; C-102 $1,000; C-103 $2,000).
- Closing balance per schedule, Nov 30: $33,000.
- Of the revenue recognized, from the opening balance: $3,000 (C-101 and C-103).
- GL account 2400, Nov 30: $33,450.
- Difference: $450, traced to a manual journal entry that credited deferred revenue for a setup fee with no contract row behind it.
The fix is not to plug the $450. Either the setup fee belongs in the contracts table with its own service period, or the entry belongs somewhere else. Once the source is corrected, rerun all three queries.
What does the finished waterfall look like?
The waterfall itself is one grouped query on the schedule, filtered to what was billed by Nov 30 and still unearned:

- C-101 Acme: Dec 2026 $1,000; Q1 2027 $3,000; Q2 2027 $3,000; Q3 2027 $3,000; total $10,000.
- C-102 Birch: Dec 2026 $1,000; Q1 2027 $3,000; Q2 2027 $1,000; Q3 2027 $0; total $5,000.
- C-103 Cobalt: Dec 2026 $2,000; Q1 2027 $6,000; Q2 2027 $6,000; Q3 2027 $4,000; total $18,000.
- Total: Dec 2026 $4,000; Q1 2027 $12,000; Q2 2027 $10,000; Q3 2027 $7,000; total $33,000.
The total column equals the rollforward's closing balance by construction, because both come from the same rows. That is the point of building it this way. In a spreadsheet, those two numbers live on different tabs and can disagree.
Why doesn't my deferred revenue waterfall tie to the GL?
When the tie-out shows a difference, check these in order:
- Manual journal entries. Entries posted straight to deferred revenue with no contract or schedule. A June 2026 question in the NetSuite Professionals community describes exactly this symptom: a waterfall and GL balance that "are out of sync but they should tie out" (NetSuite Professionals).
- Contract changes. An upgrade, downgrade or early termination updated the invoice but not the schedule.
- Billing timing. Invoices dated in one month and posted in another.
- Credit memos and refunds. Reduced the receivable and revenue but not the remaining deferred balance.
- Convention mismatch. The schedule uses whole months while the billing system uses days.
- Wrong account mapping. A product that should never defer has a deferred revenue account assigned.
Each item should be fixed in the source data, then the queries rerun. If you are heading into a sale process, a clean, replayable deferred revenue rollforward is one of the first things a quality of earnings review will test.
FAQ
What is the difference between a deferred revenue waterfall and a rollforward?
A waterfall spreads the current deferred balance across the future months it will be recognized. A rollforward explains how the balance moved in one period: opening plus billings minus recognized equals closing. Build both from the same schedule table so they always agree.
How do you calculate deferred revenue for a subscription?
Take the amount billed for the service period, divide it by the number of periods under your recognition convention, and recognize one portion each period. Deferred revenue at any date is what has been billed but not yet recognized.
Can you build a deferred revenue schedule in Excel?
Yes, and many teams do. The risk is drift: overridden cells, copied tabs and ranges that miss new rows. Whatever the tool, tie the closing balance to the GL every month and keep the logic in one place a reviewer can read.
Do private companies have to disclose a deferred revenue rollforward under ASC 606?
Not in full. Per BDO's Topic 606 disclosure guide, nonpublic entities can elect to disclose only the opening and closing balances of receivables, contract assets and contract liabilities. Auditors still expect a rollforward that ties as support.
What is the next step?
Export last month's contracts and your deferred revenue GL balance, load them into two tables, and run the three queries above. Whatever difference comes out is your first reconciling item. To hear when Yoraito opens up, join the waitlist.