Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Churned customers
Customer retention charts
8. Customer retention chart – exercise


Good job! One more exercise before we move on.


Create a customer retention chart based on monthly signup cohorts for all years. It should have the following columns:

  • Year
  • Month
  • PercentActive14d (the percentage of customers still active after 14 days)
  • PercentActive30d (the percentage of customers still active after 30 days)

Order the results by year and month.

Stuck? Here's a hint!

Calculate the PercentActive14d column as:

COUNT(CASE WHEN DATEDIFF(Day, RegistrationDate, LastOrderDate) > 14 THEN CustomerID END) * 100.0 / COUNT(CustomerID)