Skip to main content
All Problems
hard0% acceptance

Monthly Cohort Retention Analysis

Perform a cohort retention analysis. Define each customer's cohort as the month of their first order. For each cohort month and subsequent order month, count distinct customers. Show cohort_month, order_month, months_since_first (0, 1, 2...), and customer_count. Sort by cohort_month, then months_since_first.

Schema

🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute