← Back to portfolio Cohort Analysis Dashboard preview
Stack
Pythonpandasmatplotlib / seabornJupyter NotebookTableau (Hyper API)
Impact
  • Cohort retention matrix with triangular decay
  • ARPU / LTV by cohort with proper observation-age caveat
  • Tableau-ready export (CSV + .hyper extract)
  • Reproducible seeded pipeline (seed=42)
Source View on GitHub → Updated: Sep 4, 2026

Cohort Analysis Dashboard

Context

Cohort retention and LTV analysis on synthetic data: user retention, churn curves, and revenue/LTV by acquisition cohort. A Python pipeline (pandas + matplotlib/seaborn) plus an export ready to load into Tableau. Data is synthetic, deterministic (seed=42), reproduced from code.

Hypothesis

If we split users into cohorts by first-activation month and build a retention matrix + retention curves + ARPU/LTV, the churn speed per cohort becomes visible, along with where monetization drops faster than retention.

Data & Method

Data model — one row = “user × observation month”:

Field Type Description
user_id int user identifier
cohort_month date arrival month (derived from join_date, not a separate field)
join_date date registration date (first of month)
period int months since arrival (0 = registration month)
is_active int 0/1 active in this month
revenue int revenue for the month (0 if inactive)

cohort_month is derived from join_date, as in real production. Younger cohorts have fewer observed months — the retention matrix is triangular.

Methodology:

  • Period 0 = 100% retention by definition (all active in arrival month). The curve decays from period 1: retention(p) = 0.85 · 0.75^(p-1).
  • Revenue: active month → Poisson(λ=10); inactive → 0.
  • Cohort sizes — count of unique user_id where period == 0.
  • ARPU — average revenue per cohort user; LTV — cumulative ARPU over periods.

Functions: cohort_sizes() (monthly inflow), retention_matrix() (matrix + curves), revenue_by_cohort() (ARPU/LTV).

Tableau export (tableau_export.py) creates in tableau/:

  • cohort_export.csv — flat shape for Tableau (adds cohort_label and period_date — the calendar observation month);
  • cohort_extract.hyper — a Tableau Hyper extract via the official Hyper API.

Tableau heatmap: Columns = period, Rows = cohort_label, Marks = Square, Color = AVG(is_active), Text = % of Total per row.

Findings

The cohort view matters more than average retention: it shows not only churn speed but also monetization compared to retention. LTV of younger cohorts is understated due to short history — compare LTV correctly only at equal cohort “age.” Key improvements: cohort_month is derived from join_date (not a separate random field), period 0 = 100% by convention, and NaNs are masked in the heatmap instead of rendering nan%.

Impact

  • Cohort retention matrix with triangular decay — shows the month a cohort loses activity.
  • ARPU / LTV by cohort with a correct observation-age caveat.
  • Tableau-ready export — CSV + .hyper extract, with a view-build instruction.
  • Reproducible pipelineuv + pyproject.toml + .python-version, seed=42.

Documentation

Charts

Source: github.com/NikitaBoyarkin/tableau_cohort_analysis: cohort_data.csv (5,469 user-period rows, 1,000 users, cohorts 2023-01..2023-10) — metrics computed with pandas from the committed CSV artifact: cohort sizes at period 0, retention mean by cohort x period, blended retention by period, cohort LTV = total_revenue / users

Cohort retention matrix

Share of active users by join cohort (rows) and months since join (columns). The join month is 100% by definition. The full matrix is triangular — younger cohorts have a shorter observation history. Shown is the fully observed 5 x 6 slice; every value is real.

2023-01 2023-02 2023-03 2023-04 2023-05 M0 M1 M2 M3 M4 M5 2023-01 · M0: 100% 100% 2023-01 · M1: 83.5% 83.5% 2023-01 · M2: 57.7% 57.7% 2023-01 · M3: 39.2% 39.2% 2023-01 · M4: 33% 33% 2023-01 · M5: 21.6% 21.6% 2023-02 · M0: 100% 100% 2023-02 · M1: 81% 81% 2023-02 · M2: 65.5% 65.5% 2023-02 · M3: 45.7% 45.7% 2023-02 · M4: 34.5% 34.5% 2023-02 · M5: 25.9% 25.9% 2023-03 · M0: 100% 100% 2023-03 · M1: 86% 86% 2023-03 · M2: 66.3% 66.3% 2023-03 · M3: 48.8% 48.8% 2023-03 · M4: 32.6% 32.6% 2023-03 · M5: 30.2% 30.2% 2023-04 · M0: 100% 100% 2023-04 · M1: 84.4% 84.4% 2023-04 · M2: 67.5% 67.5% 2023-04 · M3: 44.2% 44.2% 2023-04 · M4: 44.2% 44.2% 2023-04 · M5: 29.9% 29.9% 2023-05 · M0: 100% 100% 2023-05 · M1: 86.1% 86.1% 2023-05 · M2: 65.2% 65.2% 2023-05 · M3: 49.6% 49.6% 2023-05 · M4: 38.3% 38.3% 2023-05 · M5: 26.1% 26.1% 0 100%
Key takeaways
  • Month-1 retention is 81.0–86.7%; after 5 months it falls to 21.6–30.2%.
  • The steepest decline is cohort 2023-01: from 83.5% at M1 to 21.6% at M5 — down 72% from its month-1 level.

Cohort sizes

Unique users who joined in each month, counted at period 0.

0 50 100 150 2023-01 — users: 97 97 2023-02 — users: 116 116 2023-03 — users: 86 86 2023-04 — users: 77 77 2023-05 — users: 115 115 2023-06 — users: 105 105 2023-07 — users: 100 100 2023-08 — users: 108 108 2023-09 — users: 93 93 2023-10 — users: 103 103 2023-01 2023-02 2023-03 2023-04 2023-05 2023-06 2023-07 2023-08 2023-09 2023-10 Cohort Users
Key takeaways
  • Total inflow is 1,000 users over 10 months, ranging from 77 (2023-04) to 116 (2023-02) per month.
  • Peak inflow of 116 (Feb 2023) is 1.5x the minimum of 77 (Apr 2023).

Blended retention curve

Average share of active users across all cohorts by months since join. Period 0 is 100% by definition.

0 50 100 retention M0 — retention: 100 M1 — retention: 84.5 M2 — retention: 62.3 M3 — retention: 47 M4 — retention: 35.9 M5 — retention: 26.5 M6 — retention: 19.9 M7 — retention: 15.4 M8 — retention: 9.9 M9 — retention: 9.3 M0 M1 M2 M3 M4 M5 M6 M7 M8 M9 Months since join Active, %
Key takeaways
  • 47.0% of users remain after 3 months; only 9.3% remain after 9.
  • More than half churn within the first 3 months: 53.0% churn by M3.

LTV by cohort

Cohort total revenue divided by cohort size. Younger cohorts show lower LTV only because less history is observed — compare cohorts of equal age.

0 10 20 30 40 2023-01 — ltv: 37.82 37.82 2023-02 — ltv: 39.47 39.47 2023-03 — ltv: 39.63 39.63 2023-04 — ltv: 39.45 39.45 2023-05 — ltv: 36.53 36.53 2023-06 — ltv: 34.11 34.11 2023-07 — ltv: 29.79 29.79 2023-08 — ltv: 23.2 23.2 2023-09 — ltv: 18.29 18.29 2023-10 — ltv: 10.3 10.3 2023-01 2023-02 2023-03 2023-04 2023-05 2023-06 2023-07 2023-08 2023-09 2023-10 Cohort LTV, revenue units
Key takeaways
  • Highest LTV is 39.63 (2023-03); the lowest is 10.30 (2023-10).
  • The 3.8x gap between oldest and newest cohort (39.63 vs 10.30) reflects the cohort-age effect, not worsening quality.

See also

Connection map

Projects, posts and topics connected to this one. Hover a node to see its name; click to open.