Phase 4 part 2: MRR, its movements, NRR and cohorts

Each customer's MRR at each month's end, from the recurring lines of paid
and open invoices: the amount after discounts over the billing interval,
prorations over their part-period. Moves are new, expansion, contraction,
churn and reactivation (sub-dollar noise ignored); NRR monthly and over
12 months; cohorts by first paid month. A start month, suggested when
most of the business appears at once (billing moved to Stripe), makes
those customers the base. Metrics page with a chart, the month table,
cohorts, and each month's customer moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 12:17:53 -07:00
co-authored by Claude Opus 5.5
parent 2c242d8c94
commit 5e799c7541
11 changed files with 860 additions and 2 deletions
+28
View File
@@ -1057,6 +1057,34 @@ into `main`.
- Each month's movements: new, expansion, contraction, churn,
reactivation.
- NRR monthly and over the trailing 12 months, by signup cohort.
- **Built 2026-11-22** (no schema change):
- `metrics.Build` measures each customer's MRR at each month's last
second (the current month: now). It sums the recurring lines of
paid and open invoices in the main currency whose period covers
that moment.
- A normal line is divided by its interval (a year counts as 12
months, a week as 52/12). A proration is spread over its actual
part-period, so an upgrade counts from its day. Under a cent counts
as nothing (trials).
- Moves: new, expansion, contraction, churn, reactivation. Changes
under $1 or 1% are noise from the proration arithmetic.
- NRR for a month is what last month's customers pay now ÷ what they
paid then. NRR over 12 months is what the customers of 12 months
ago pay now ÷ what they paid then.
- Cohorts are by the first paid month, with the retained share of
starting MRR for up to 12 months.
- **Start month.** When 20+ customers and most of the MRR appear as
new in one month, the app suggests counting from it. That's what
happened in January 2025 on the live account: billing came back to
Stripe after a gap through most of 2024. Customers paying in the
start month are the base, not new. You can choose "count
everything" instead.
- The pages are Metrics (MRR now, ARR, ARPA, NRR, a 24-month SVG
chart, the month-by-month table, cohorts) and Metrics → a month
(each customer's move).
- On the live data, both large swings are real: in June 2026 a
customer paying about $2,075 a month left, and in July 2026 prices
rose across the plans.
3. **Matching Stripe customers to EspoCRM Accounts** (from the cached CRM
records), by stored ID, email or email domain, with a screen to fix
wrong matches. Customers already tied to prospects (Phase 2) keep that