Lesson 13 of 14 · 30 min
Cohort analysis
By the end of this lesson you can assign customers to signup cohorts, compute the months since signup for any activity, count active members per cohort and age, and pivot the result into a cohort table with percentages.
A cohort is a group of customers who share a starting point, usually the month they signed up (or made their first purchase). Cohort analysis asks: of the accounts that joined in March 2024, how many were still active one month later, three months later, six months later? and then compares cohorts with each other at the same age.
This lesson uses Mizan Cloud, a fictional B2B SaaS company. An account's cohort is the month of accounts.created_at; an account is active in a month if any of its users produced at least one event in events that month. Mizan's five internal test accounts generate lots of events and must be excluded.
This lesson, its 4 graded exercises and every other Members lesson in SQL Quest come with a Formula Quest membership that includes SQL (Single Quest with SQL selected, Quest Trio including SQL, or Quest Unlimited), or with SQL access from your organization.
Free to everyone: all of SQL Foundations and Retrieving and Filtering Data, the first lesson of every track, the playground, the dataset library and the SQL reference. See free lessons