Ad Campaign Funnel Analysis
Problem
**[Asked at Facebook/Meta]**
A digital ad campaign tracks users through three stages: they see an impression,
some click, and some then sign up. For each stage, calculate:
1. How many distinct users reached that stage
2. What percentage of the **previous stage** converted (drop-off rate)
Use these stage labels in order: `impression` → `click` → `signup`.
Return `stage`, `user_count`, and `pct_of_prev` (NULL for the first stage, rounded to 1 dp for others).
Tables
Example rows — the live problem includes the full dataset.
| event_id | user_id | stage | event_date |
|---|
Expected output
Your answer should return 3 rows with the columns stage, user_count, pct_of_prev.
Starter code (SQL)
SELECT *
FROM funnel_events;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock