Back to problems

Calculate Cohort Retention

SQL · Intuit · Hard

Given two tables that record account creation and activity: users contains user_id and signup_ts, and user_events contains user_id, event_ts, and event_name. Every user_events.user_id references a corresponding users.user_id. All timestamps are in UTC. For each user, define their cohort month as the first day of the calendar month containing their signup_ts. For example, a signup on 2022-12-15 belongs to the 2022-12-01 cohort. A user is considered retained at month number n…

Checking your access…