MRR by customer month
MRR per customer per month, and the movement that took it there: new, expansion, contraction, churn or reactivation.
- Grain
- month x customer x currency
- Built from
- 7Raw tables
- 7Staging
- 2Core
- 1Analytics
- Reads from Chargebee
- credit_notecredit_note_line_itemcustomerinvoiceinvoice_line_itemitemitem_price
- Ships as
- Weld and dbt SQL, open source on GitHub
1-- core.chargebee.mrr_by_customer_month
2-- MRR per customer per month, and the movement that took it there: new,
3-- expansion, contraction, churn or reactivation.
4--
5-- Grain: month x customer x currency. A customer appears from the first month they
6-- had MRR, in every month they had MRR, and in the month they churned. Months
7-- after a churn with no MRR are left out until the customer comes back.
8-- Currency: the invoice currency, major units. A customer billed in two
9-- currencies has two rows per month.
10-- Depends on: core.chargebee.recurring_revenue_lines
11--
12-- MRR AT A MONTH is the sum of monthly_amount over every recurring line whose
13-- service period covers the snapshot date: the last day of the month, or today
14-- for the month in progress. A subscription cancelled at the end of its term stops
15-- counting the day its last paid period ends; one cancelled immediately stops on
16-- the day of its cancellation credit note.
17--
18-- MOVEMENTS, with beginning_mrr = the previous month's MRR:
19-- new beginning 0, MRR > 0, and never had MRR before
20-- reactivation beginning 0, MRR > 0, had MRR in some earlier month
21-- expansion beginning > 0, MRR higher
22-- contraction beginning > 0, MRR lower but above 0 (stored negative)
23-- churn beginning > 0, MRR 0 (stored negative)
24-- So beginning_mrr + new + expansion + contraction + churn + reactivation =
25-- mrr, on every row. tests/assert_chargebee__mrr_movements_reconcile.sql checks it.
26--
27-- Movements are measured per CUSTOMER, which is how Chargebee and most SaaS
28-- reporting count them: a customer moving from plan A to plan B is an expansion
29-- or a contraction, not a churn plus a new. Weld does not sync the subscription id
30-- on invoice lines, so a subscription grain is not reliable for consolidated
31-- invoices; `subscription_id` is still on recurring_revenue_lines where known.
32--
33-- The snapshot uses invoices. A renewal that has not been invoiced yet, or usage
34-- billed in arrears, is missing until the invoice exists, so the current month
35-- is provisional until month end.
36
37WITH lines AS (
38 SELECT * FROM {{core.chargebee.recurring_revenue_lines}}
39),
40This model and the 9 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().
How it counts. And where it stops.
MRR AT A MONTH is the sum of monthly_amount over every recurring line whose service period covers the snapshot date: the last day of the month, or today for the month in progress. A subscription cancelled at the end of its term stops counting the day its last paid period ends; one cancelled immediately stops on the day of its cancellation credit note. MOVEMENTS, with beginning_mrr = the previous month's MRR: new beginning 0, MRR > 0, and never had MRR before reactivation beginning 0, MRR > 0, had MRR in some earlier month expansion beginning > 0, MRR higher contraction beginning > 0, MRR lower but above 0 (stored negative) churn beginning > 0, MRR 0 (stored negative) So beginning_mrr + new + expansion + contraction + churn + reactivation = mrr, on every row. tests/assert_chargebee__mrr_movements_reconcile.sql checks it. Movements are measured per CUSTOMER, which is how Chargebee and most SaaS reporting count them: a customer moving from plan A to plan B is an expansion or a contraction, not a churn plus a new. Weld does not sync the subscription id on invoice lines, so a subscription grain is not reliable for consolidated invoices; `subscription_id` is still on recurring_revenue_lines where known. The snapshot uses invoices.
Raw tables it reads
- raw.chargebee.credit_note
- raw.chargebee.credit_note_line_item
- raw.chargebee.customer
- raw.chargebee.invoice
- raw.chargebee.invoice_line_item
- raw.chargebee.item
- raw.chargebee.item_price
More Chargebee models
Put Chargebee in front
of your agents.
Connect Chargebee, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.