Telemetry
Product analytics SQL recipe

Calculate DAU, WAU, and Product Stickiness

Measure daily and weekly active users together and calculate DAU-to-WAU stickiness from a consistent activity definition.

Advancedproduct_eventsReviewed 2026-07-27Tested with Apache DataFusion 45.2.0

Reviewed by the Telemetry product team on . SQL compatibility, event contract, synthetic output, and operational caveats. Review standards and ownership

Question answered

What share of weekly active users returns on an average day?

An active-user metric is only comparable when the actor and qualifying event remain stable. Stickiness shows how much of the weekly audience is active on a given day.

Event contract

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampActivity time.
user_idUtf8Stable actor identifier.
event_nameUtf8Qualifying product action.
DataFusion SQL

Copy the query

sql
WITH daily_users AS (
  SELECT DISTINCT
    date_trunc('day', timestamp_utc) AS activity_day,
    user_id
  FROM product_events
  WHERE timestamp_utc >= now() - INTERVAL '35 days'
    AND event_name IN ('feature_used', 'dashboard_viewed', 'query_run')
),
days AS (
  SELECT DISTINCT activity_day
  FROM daily_users
),
activity AS (
  SELECT
    days.activity_day,
    COUNT(DISTINCT CASE
      WHEN daily_users.activity_day = days.activity_day
      THEN daily_users.user_id
    END) AS dau,
    COUNT(DISTINCT daily_users.user_id) AS wau
  FROM days
  JOIN daily_users
    ON daily_users.activity_day BETWEEN
      days.activity_day - INTERVAL '6 days' AND days.activity_day
  GROUP BY days.activity_day
)
SELECT
  activity_day,
  dau,
  wau,
  100.0 * dau / NULLIF(wau, 0) AS stickiness_pct
FROM activity
ORDER BY activity_day;

This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. The deterministic sample output is synthetic and reviewed separately; validate field types, thresholds, and business definitions against your own data. Read the testing methodology.

Query result

Daily active users

Daily activity increased across the final three complete days.

activity_daydauwaustickiness_pct
2026-07-258125,12015.86
2026-07-268465,24416.13
2026-07-279105,40816.83

Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.

Daily active users: static chart of synthetic dau values from the Calculate DAU, WAU, and Product Stickiness example result
Indexable SVG of the deterministic example output. Download it for an article, runbook, or design review with attribution.

Reproduce the example

Download the public fixture

The JSON bundle includes the typed event contract, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.

How the SQL works

  1. 1The first CTE deduplicates repeated qualifying events by user and day.
  2. 2Joining each reporting day to the preceding seven activity days produces an exact distinct WAU denominator.
  3. 3Stickiness is the day’s distinct active users divided by that day’s rolling distinct weekly active users.

Edge cases to decide

  • Do not use page views or sign-ins if they are inconsistent proxies for meaningful activity.
  • Anonymous-to-identified user merging changes distinct counts.
  • Exclude incomplete current days from reporting comparisons.

Recommended dashboard

  • Trend: DAU and exact WAU
  • Stat: DAU/WAU stickiness
  • Table: active users by plan or acquisition source

Alert guidance

Use anomaly or sustained-change review rather than paging on normal daily engagement variation.

Read alert setup

Put the recipe to work

Related instrumentation and guides

Continue the analysis

Run it on real events

Create a table, adapt the fields, and save the result

Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.

Get an API key