With a "Count from" month set, that month's cohort is everyone already
paying then, not only those new that month. Both cohort tables now say
"existing customers" under it, the help text explains, and both cohort
CSVs add an existing_customers column.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
When the earliest recurring invoice Stripe has for a customer is a renewal
(billing_reason subscription_cycle), they were a customer already, their
first year free or billed elsewhere. That first payment now counts as
reactivation (movement "existing"), not new: it stays out of New, the
cohorts and CAC, and the month's movements still add up. The customers
export gives the month first seen paying as first_paid. A $0 trial signup
before the first payment still makes a customer new.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Open (unpaid) invoices no longer count toward MRR, so they don't put a
customer in a cohort either; an invoice counts once it's paid. This
matches the customer count, which takes only those who have spent more
than $0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
db.DB wraps database/sql for either database. The SQL stays SQLite's: on
Postgres each statement's ? become $n and LIKE ignores case as SQLite's
does, and the Postgres schema (postgres.sql, schema 29 as a whole) adds
SQLite's instr, json_extract and two-argument max/min, and a nocase ICU
collation. Needs Postgres 18.
LastInsertId became db.Insert (RETURNING id), INSERT OR IGNORE became ON
CONFLICT DO NOTHING, upserts qualify their columns, and three queries
group by every column they use. SUPERMARKET_TEST_POSTGRES runs the test
suite on Postgres, a new schema per test; all tests pass on both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>