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
  • percent_active_14d (the percentage of customers still active after 14 days).
  • percent_active_30d (the percentage of customers still active after 30 days).

Order the results by year and month.

Stuck? Here's a hint!

Calculate the percent_active_14d column as:

COUNT(CASE WHEN last_order_date - registration_date > INTERVAL '14' day THEN customer_id END) * 100.0 / COUNT(customer_id)