Metrics: cohorts show each month's dollars beside the percentage

Each cohort cell now gives what the same customers pay that month, in
dollars, under the share of their starting MRR. The cohorts CSV adds
month_N_mrr columns after the month_N_pct ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 12:58:38 -07:00
co-authored by Claude Opus 5.5
parent 06b17b9eab
commit ea94324c3b
4 changed files with 22 additions and 5 deletions
+4
View File
@@ -120,6 +120,10 @@ func TestBuild(t *testing.T) {
if len(cos) != 3 || cos[0].Month != "2026-03" || cos[2].Month != "2026-01" || cos[2].Retained[0] != 100 || !near(cos[2].Retained[3], 100*(5000+3044)/5000) {
t.Errorf("cohorts: %+v", cos)
}
// The same customers' dollars, month by month; none beyond today.
if !near(cos[2].MRR[0], 5000) || !near(cos[2].MRR[3], 5000+3044) || m.Cohorts(1, 4)[0].MRR[4] != -1 {
t.Errorf("cohort MRR: %v, %v", cos[2].MRR, cos[0].MRR)
}
ch := m.Changes("2026-04", map[string]Customer{"cus_b": {ID: "cus_b", Name: "Bea"}})
if len(ch) != 2 || ch[0].Customer.Name != "" || ch[1].Customer.Name != "Bea" || ch[1].Kind != MoveChurn {
t.Errorf("changes: %+v", ch)