users(user_id, signup_at) and events(user_id, event_type, event_at)
For each signup month report the cohort size, the percentage of users who
completed a 'profile' event after signing up, and the percentage who completed
a 'first_purchase' event after their profile event.
Return signup_month as 'YYYY-MM', cohort_size, profile_pct and
purchase_after_profile_pct, both rounded to two decimals, ordered by month.
Both percentages are out of the whole cohort.
A purchase that happened before the profile does not count, so the purchase check has to be anchored to the profile timestamp rather than to signup.
Tables
events
user_id event_type event_at
------- -------------- -------------------
1 profile 2026-01-06 10:00:00
1 first_purchase 2026-01-08 10:00:00
2 first_purchase 2026-01-11 10:00:00
2 profile 2026-01-12 10:00:00
3 profile 2026-01-19 10:00:00
4 profile 2026-02-03 10:00:00
4 first_purchase 2026-02-09 10:00:00
users
user_id signup_at
------- -------------------
1 2026-01-05 10:00:00
2 2026-01-10 10:00:00
3 2026-01-20 10:00:00
4 2026-02-02 10:00:00
Expected result
signup_month cohort_size profile_pct purchase_after_profile_pct
------------ ----------- ----------- --------------------------
2026-01 3 66.67 33.33
2026-02 1 100.00 100.00