All courses
Intermediate

Product analytics: usage, activation and retention

Turn raw usage events into active-account, adoption, activation and retention numbers you can defend in a product review, without counting events as customers or mixing churned accounts into current metrics.

8 exercises · 45 minutes · Data: SaaS company
Start course
SQL
01
→ 02
→ 03

Your exercises

01
Monthly active accounts from usageNew

The product team reports monthly active accounts (MAU) from usage, not billing. An account is active in a month if it has at least one event of any type in that month. For each month from January to September 2026 return four columns: month ('YYYY-MM'), the number of active accounts, the number of events, and events per active account rounded to 1 decimal. Sort by month from oldest to newest.

4 min
02
Export feature adoption by planNew

Is the export feature catching on? Look at Q3 2026 (event_date from 2026-07-01 to 2026-09-30). An account is active in Q3 if it has at least one event of any type in Q3, and is an export user if at least one of its Q3 events is an 'export'; accounts that churned during Q3 still count if they were active. For each plan return plan, active accounts, export users, and adoption as export users divided by active accounts, as a percentage rounded to 1 decimal. Sort by plan A to Z.

5 min
03
September usage of current customersNew

Customer success wants September 2026 usage per plan for current customers only, meaning accounts whose churned_at is NULL. For each plan return plan, number of current customers, their total number of events dated in September 2026, and the average September events per current customer rounded to 1 decimal. Current customers with no September events must count as 0 in the average. Any row order is fine.

5 min
04
Days to first report for 2026 signupsNew

Product wants to see how long new customers take to reach their first report. For every account created in 2026, return company, created_at, the date of its first 'report_created' event, and the whole number of days from created_at to that first report. Logins and exports do not count. Accounts that never created a report must still appear, with NULL in the last two columns. Any row order is fine.

5 min
05
Activation rate by planNew

An account is activated if it created at least one report ('report_created') on its signup day or within the following 29 days: event_date on or after created_at and before created_at + 30 days. For each plan, over all accounts including churned ones, return plan, number of accounts, number of activated accounts, and activation rate as a percentage rounded to 1 decimal. Sort by activation rate highest first, then plan A to Z.

6 min
06
How quiet did customers go before churning?New

Did churned customers go quiet before they left? For every account with churned_at not NULL, return company, churned_at, the date of its last event before churned_at, the whole number of days from that last event to churned_at, and the number of events in the 30 days before churn (event_date on or after churned_at minus 30 days and before churned_at), which must be 0 when there were none. Sort by days silent highest first, then company A to Z.

6 min
07
Month-2 retention by signup cohortNew

Measure month-2 retention by signup cohort. An account's cohort is the month of its created_at ('YYYY-MM'). It is retained if it has at least one event of any type in the calendar month right after its cohort month (for the 2026-02 cohort, that is 2026-03). Return cohort, accounts in the cohort, retained accounts, and retention as a percentage rounded to 1 decimal, for every cohort, including cohorts where nobody was retained (0 and 0.0). Sort by cohort from oldest to newest.

7 min
08
Current customers who went dormant and came backNew

Find current customers (churned_at is NULL) who once went quiet for more than 60 days and then came back. For each account, put its events in date order and compute the gap in days between each event and that same account's previous event. Return company and the longest such gap in days, only for current customers whose longest gap is more than 60 days. Sort by longest gap highest first, then company A to Z.

7 min
Queries run on sample company data in SQLite. Core SELECT, JOIN and GROUP BY patterns transfer to other SQL engines; functions, dates and types can differ.