← Practice

ARPU and ARPPU for the first 14 days: Feb–Apr 2025, RU

Level: SeniorTopic: Retention, funnels, cohorts200 XP

Instructions

A cohort is the users of one platform who signed up (users.signup_at) in one calendar month (cohort_month is the first day of the month). Take users from the country 'RU' who signed up from February 1, 2025 to April 30, 2025 inclusive. Count only purchases (purchases) within the first 14 days after signup: purchased_at < signup_at + interval '14 days'. For each cohort, output cohort_month, platform, cohort_size (the number of users in the cohort: all who signed up), payers (the number of users with at least one such purchase), revenue (the sum of these purchases, 0 if there are none), arpu (revenue / cohort_size) and arppu (revenue / payers; NULL if payers = 0); round arpu and arppu to 2 decimal places. Sort by cohort_month, then platform.

Hints

Each next one is more detailed and costs more

Log in to open hints

Query

Result

Click Run to see the query result, or Check to submit your solution.

Dataset schema

events.user_id (0…N) ↔ users.id (1…1)purchases.user_id (0…N) ↔ users.id (1…1)eventsPKidintegerFKuser_idintegerpurchasesPKidintegerFKuser_idintegerusersPKidinteger
Exactly oneZero or oneZero or more
Table relationships
  • N:1Many-to-oneevents.user_id → users.id
  • N:1Many-to-onepurchases.user_id → users.id

Table data

PostgreSQL

Select a table in the diagram or list to view its rows.

Dataset schema