Summarize Monthly Recurring Revenue (MRR)
This SQL model provides a comprehensive view of the Monthly Recurring Revenue (MRR) by categorizing the revenue into new MRR, contraction MRR, churn MRR, and expansion MRR. It also computes the net new MRR and total MRR over time.
- Grain
- See the notes
- Built from
- 6Raw tables
- 1Staging
- 5Core
- 1Analytics
- Reads from Stripe
- incrementalcouponplansubscriptionsubscription_discountsubscription_item
- Ships as
- Weld and dbt SQL, open source on GitHub
1-- core.stripe.mrr_summary
2-- Summarize Monthly Recurring Revenue (MRR). This SQL model provides a
3-- comprehensive view of the Monthly Recurring Revenue (MRR) by categorizing the
4-- revenue into new MRR, contraction MRR, churn MRR, and expansion MRR. It also
5-- computes the net new MRR and total MRR over time.
6--
7-- From the weld.app template library. Not reconciled against Stripe;
8-- check the output against the source before relying on it.
9
10with mrr_calc as (
11 select *
12 , case when mrr_rank_asc = 1 then mrr_change else 0 end as new_mrr
13 , case when mrr_change < 0 then mrr_change else 0 end as contraction_mrr
14 , case when mrr_change > 0 and mrr_rank_asc > 1 then mrr_change else 0 end as expansion_mrr
15 , case when mrr_rank_desc = 1 and status = 'canceled' then mrr * -1 else 0 end as churn_mrr
16 from {{core.stripe.mrr_time_series}})
17 , net_mrr_calc as (
18 select month
19 , sum(new_mrr) new_mrr
20 , sum(contraction_mrr) contraction_mrr
21 , sum(churn_mrr) churn_mrr
22 , sum(expansion_mrr) expansion_mrr
23 , sum(new_mrr + contraction_mrr + churn_mrr + expansion_mrr) as net_new_mrr
24 from mrr_calc
25 group by month)
26 select month, new_mrr, contraction_mrr, churn_mrr, expansion_mrr, net_new_mrr, sum(net_new_mrr) over (order by month asc) as mrr_total from net_mrr_calcThis model and the 6 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.
By understanding the different components of MRR, businesses can pinpoint areas of growth or potential issues. The breakdown helps in identifying trends in customer acquisition, churn, or expansion and provides a clear picture of the business health over time.
Raw tables it reads
- raw.forex_eur.incremental
- raw.stripe.coupon
- raw.stripe.plan
- raw.stripe.subscription
- raw.stripe.subscription_discount
- raw.stripe.subscription_item
Put Stripe in front
of your agents.
Connect Stripe, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.