How to calculate Day-30 Retention

Day-30 retention is the percentage of new users who are still active about 30 days after they signed up.

Formula

Day-30 retention = users active on or around day 30 ÷ users who signed up × 100

SQL query

This example assumes: users(id, signed_up_at), events(user_id, occurred_at). It is written in PostgreSQL syntax; date functions differ slightly in MySQL, BigQuery and SQLite, and your column names will differ from these.

SELECT DATE_TRUNC('week', u.signed_up_at) AS signup_week,
       COUNT(DISTINCT u.id) AS signups,
       COUNT(DISTINCT e.user_id) AS active_day_28_to_35,
       COUNT(DISTINCT e.user_id) * 100.0 / NULLIF(COUNT(DISTINCT u.id), 0) AS d30_retention_pct
FROM users u
LEFT JOIN events e
  ON e.user_id = u.id
 AND e.occurred_at >= u.signed_up_at + INTERVAL '28 days'
 AND e.occurred_at <  u.signed_up_at + INTERVAL '35 days'
WHERE u.signed_up_at < CURRENT_DATE - 35
GROUP BY 1
ORDER BY 1;

Common mistakes that make Day-30 Retention wrong

  • Exact day-30 activity is noisy; a window around day 30 is more stable (this query uses days 28–35).
  • Cohorts younger than 35 days are not yet measurable and are excluded on purpose.
  • Define 'retained' as a meaningful action, not just a session.

Ask for Day-30 Retention in plain English

Instead of writing the query yourself, you can type the question. SchemaChat turns it into SQL against your connected database or uploaded file, runs it, and shows the SQL and the figures it used so you can check the answer before you share it. It does not replace your judgement about the definition: check that the query matches the formula your business uses.

  • What is day-30 retention by signup week?
  • How does retention differ between users who completed onboarding and those who did not?

Frequently asked questions

What is Day-30 Retention?
Day-30 retention is the percentage of new users who are still active about 30 days after they signed up.
How do you calculate Day-30 Retention?
Day-30 retention = users active on or around day 30 ÷ users who signed up × 100. The SQL example on this page shows the same calculation against a simple table.
What commonly goes wrong when calculating Day-30 Retention?
Exact day-30 activity is noisy; a window around day 30 is more stable (this query uses days 28–35).