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, AllCustomers, ChurnedCustomers, and ChurnedPercentage. 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 ChurnedPercentage column as:

COUNT(CASE WHEN DATEDIFF(Day, LastOrderDate, GETDATE()) > 60 THEN CustomerID END) * 100.0 / COUNT(CustomerID) AS