Day-1 retention by week: 4 weeks from January 6, 2025
Instructions
A cohort is the users who signed up (users.signup_at) in one calendar week; a week starts on Monday, and cohort_week is the date of that Monday (date_trunc('week', signup_at)::date). Take the users who signed up from January 6, 2025 to February 2, 2025 inclusive. A user is retained on day 1 if they have at least one event (events) on exactly the 1st calendar day after signup: event_time::date = signup_at::date + 1 (the signup day is day 0). For each cohort, output cohort_week, cohort_size (the number of users in the cohort, including those with no events at all), retained (the number of retained users; each is counted once) and retention_pct (retained / cohort_size × 100, rounded to 1 decimal place). Sort by cohort_week.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
events.→user_id users.id - N:1Many-to-one
purchases.→user_id users.id
Table data
Select a table in the diagram or list to view its rows.