Real-world recipes · SaaS finance

Monthly recurring revenue (MRR) by month

In Excel, you'd reach for
fxA SUMIFS over start and end dates, copied across one column per month

MRR on a date is the sum of mrr for every subscription that was active on that date: started on or before it, and not cancelled yet.

First we need a list of months to measure. WITH RECURSIVE builds one: start at January and keep adding a month until June. Then we join each month-end to the subscriptions active on it.

Try itEdit the query, then Run
monthmrrpaying_customers
2026-01124921
2026-02322961
2026-036977123
2026-049251149
2026-0512244196
2026-0616481249

6 rows

The WITH part is a temporary table that lives only for this query. It's the SQL version of a helper sheet.

Your turn

Simpler check: what is MRR today, meaning the sum of mrr for subscriptions with no cancelled_at? Call it current_mrr.

This page on one card

Monthly recurring revenue (MRR) by month: the Excel way (A SUMIFS over start and end dates) and the SQL query, side by side
Monthly recurring revenue (MRR) by month, on one card: the Excel way and the SQL. Download · Save to Pinterest
The practice data (7 tables)

See every column and sample rows