DataLane

5. Event funnel by stage

mediumProNot started~10 minAggregation

Asked in screens shaped like: Meta, Snap, Pinterest

Product wants funnel volume per stage: how many events fired and how many distinct customers reached each one. Total events overstates reach because one customer can fire the same event repeatedly.

Requirements

  • Columns: event_name, events, customers
  • Only event_name in ('page_view', 'add_cart', 'purchase')
  • events counts rows; customers counts distinct customer_id
  • Order by customers descending, then event_name

Expected output

event_name, events, customers

Row order is graded, so ORDER BY matters here.

SQL editor

Loading SQL engine…

Ctrl/Cmd + Enter submits

Run your query to see the result set.

Pro problem

Medium problems unlock with Pro

Easy pads stay free. Medium and hard SQL and Python problems — editor, tests, hints, and solutions — open after you upgrade to Pro or coaching.

See plansPractice free easy problems
↑↓ navigate openesc close