← Retention, funnels, cohorts

Purchase conversion by day: Apr 2025, android, 0–5

Level: Senior200 XP

Instructions

A cohort is users of the platform 'android' who signed up (users.signup_at) in April 2025. The day of a user's first purchase is the number of the calendar day of their earliest purchase (purchases) after signup: min(purchased_at)::date − signup_at::date (the signup day is day 0). For each day_n from 0 to 5, output day_n, buyers (the number of cohort users who made their first purchase on day day_n or earlier, cumulatively) and conversion_pct (buyers / cohort size × 100, rounded to 1 decimal place; the cohort size is all its users, including those with no purchases). Sort by day_n.

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