Skip to content

Day 1 and day 7 retention by sign-up month

MediumFull bankCohorts and retentionDates and timeRatios and percentages15 min2 hidden datasets

The task

Product reports classic "day 1" and "day 7" retention for each sign-up month.

Rules:

  • A user's cohort is the calendar month of users.signed_up_at.
  • The sign-up date is day 0. Day 1 is the next calendar date and day 7 is seven calendar dates after the sign-up date, in UTC. A user who signs up at 23:50 is on day 1 ten minutes later.
  • A user is retained on day 1 if they fired at least one event on the calendar date of day 1. Day 7 works the same way. Activity on other days does not count, and the two measures are independent.
  • Count users, not events. Users who never fired an event stay in the cohort.

Return cohort_month (first day of the month), cohort_size, day1_users, day7_users, day1_pct and day7_pct (percentages of the cohort, each rounded to 1 decimal place). Sort by cohort_month.

Expected output

cohort_monthcohort_sizeday1_usersday7_usersday1_pctday7_pct
  • Sorted by cohort_month ascending.
  • Numbers rounded to 1 decimal place.
  • Checked on the sample and on 2 hidden datasets. How grading works

Tables Mobile shopping app · click a name to insert it

users360 rows in the sample

One row per user. Key: user_id.

intUnique id.
timestampSign-up time (UTC).
textTwo-letter country code.
textios, android or web.
textorganic, paid, referral or partner. NULL when unknown.
events7,616 rows in the sample

One row per tracked event. Key: event_id.

bigintUnique id.
intWho fired it.
textapp_open, search, view_item, add_to_cart, begin_checkout, purchase or share.
timestampWhen (UTC).
textSession the event belongs to. NULL for a few events sent from the background.
numeric(10,2)Order value for purchase events, NULL otherwise.
experiment_assignments349 rows in the sample

Which variant each user saw in each experiment. Key: user_id, experiment.

intThe user.
textnew_onboarding or one_tap_checkout.
textcontrol or treatment.
timestampWhen the user was assigned (UTC).

Related questions

Loading the editor and PostgreSQL