How would you build a funnel analysis in SQL, measuring how many users progress through a sequence of steps?
Last updated
Pivot events to one row per user with each step's earliest timestamp, e.g.
MIN(CASE WHEN event='cart' THEN ts END)(conditional aggregation).Count a user at a step only if every prior step exists with increasing timestamps. Otherwise unordered events overstate conversion.
Count survivors per step, then divide adjacent steps (step conversion) or by step 1 (overall). Optionally require steps within an attribution window.