SQL Funnel Analysis
Start funnel analysis with distinct-user reach at each observed onboarding step.
What & Why
A funnel begins by counting how many distinct eligible entities reach each milestone. This query builds that reach table from completed product.onboarding_steps rows.
It does not calculate step-to-step conversion yet: a production funnel also needs a canonical step sequence and the eligible population for each previous stage.
See How It Works
BUSINESS QUESTION
Count unique users completing each onboarding step.
| id | user_id | step_name | completed_at |
|---|---|---|---|
| 1 | 101 | create_workspace | 2024-01-15 09:30:00+00 |
| 2 | 101 | invite_teammate | 2024-01-16 10:15:00+00 |
| 3 | 102 | create_workspace | 2024-02-10 11:30:00+00 |
| 4 | 103 | connect_data | 2024-03-13 08:45:00+00 |
EXAMPLE QUERY
SELECT
step_name,
COUNT(DISTINCT user_id) AS users_completed
FROM product.onboarding_steps
WHERE completed_at IS NOT NULL
GROUP BY step_name
ORDER BY users_completed DESC, step_name;RESULT — users completing each onboarding step
| step_name | users_completed |
|---|---|
| create_workspace | 2 |
| connect_data | 1 |
| invite_teammate | 1 |
The counts come directly from completed product.onboarding_steps rows.
This lesson's practice is part of Pro.
Sign up free to try it on a real business scenario