Skip to main content
All Problems
hard0% acceptance

Monthly Cohort Retention Rate

Calculate monthly retention rates for customer cohorts. A cohort is defined by the month of a customer's first order. For each cohort, determine what percentage of customers placed an order in subsequent months (month 0, 1, 2, etc.). Return cohort_month, months_since_first, active_customers, and retention_pct.

Schema

🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute