Metrics: the first month counted is labelled as the existing customers
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>
This commit is contained in:
@@ -172,6 +172,7 @@ type Cell struct {
|
||||
// customer, k months after their first paid month.
|
||||
type CohortRevenue struct {
|
||||
Month string
|
||||
Existing bool // the base: customers already paying when counting starts
|
||||
Customers int
|
||||
PerCustomer []Cell // cents, cumulative, for months 0, 1, 2…
|
||||
Margin []Cell // the same, after gross margin
|
||||
@@ -221,7 +222,7 @@ func RevenueByCohort(d *db.DB, m *Model, n, span int, now time.Time) ([]CohortRe
|
||||
if len(cs) == 0 {
|
||||
continue
|
||||
}
|
||||
co := CohortRevenue{Month: m.Months[i].Month, Customers: len(cs)}
|
||||
co := CohortRevenue{Month: m.Months[i].Month, Existing: m.Months[i].Month == m.Base, Customers: len(cs)}
|
||||
var cum float64
|
||||
for k := 0; k <= span; k++ {
|
||||
if i+k >= len(m.Months) {
|
||||
|
||||
Reference in New Issue
Block a user