Skip to content

Active users in the 30 days before a date

EasyFull bankDates and timeGroup and aggregate8 min2 hidden datasets

The task

The product team reports thirty-day active users per platform, measured as of 2025-06-01.

The 30-day window starts at 2025-05-02 00:00:00 and ends just before 2025-06-01 00:00:00, so an event at exactly 2025-05-02 00:00:00 is inside and one at exactly 2025-06-01 00:00:00 is outside. A user is active when they fired at least one event of any kind in the window.

Return one row per platform that has at least one active user:

  • platform: from users
  • active_users: how many different users on that platform were active

Sort by active_users descending, then platform ascending.

Expected output

platformactive_users
  • Sorted by active_users descending, then platform ascending.
  • 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