Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Churned customers
6. Percentage of churned customers in weekly cohorts – exercise
Customer retention charts


Perfect! Let's try another exercise.


Find the percentage of churned customers in monthly signup cohorts. Show the following columns: year, month, all_customers, churned_customers, and churned_percentage. Define churned customers as those who have not ordered anything in the last 60 days. Sort the results by year and month.

Stuck? Here's a hint!

Calculate the churned_percentage column as:

COUNT(CASE WHEN CURRENT_DATE - last_order_date > INTERVAL '60' day THEN customer_id END) * 100.0 / COUNT(customer_id) AS churned_percentage