SQL Daily Active Users

Active Users, applied to a one-day window, repeated for every day in the data.

What & Why

DAU groups events by calendar day and counts distinct users per day — the day-by-day version of the active-users idea.

See How It Works

BUSINESS QUESTION

Growth wants one DAU value for every date represented in the events table.

iduser_idevent_namecreated_atproperties
1001101signup2024-01-15 09:12:00+00{"source":"organic"}
1002101activated2024-01-16 14:25:00+00{"step":"workspace"}
1003102signup2024-02-10 11:08:00+00{"source":"paid"}
1004103report_viewed2024-03-12 16:40:00+00{"report":"retention"}
EXAMPLE QUERY
SELECT
  created_at::date AS activity_date,
  COUNT(DISTINCT user_id) AS dau
FROM growth.events
WHERE user_id IS NOT NULL
GROUP BY activity_date
ORDER BY activity_date;
RESULT — daily active users
activity_datedau
2024-01-151
2024-01-161
2024-02-101
2024-03-121

Each representative event day contains one distinct user.

This lesson's practice is part of Pro.

Advanced business practice

Sign up free to try it on a real business scenario