Skip to content

Stat

The stat widget displays a single scalar value — one large number with an optional unit. It is the right choice whenever you want to surface a KPI at a glance.

Use it for:

  • Total user count, total events, total revenue
  • Averages (average session duration, average score)
  • Conversion rates and percentages
  • Any single-number metric

A stat widget must receive exactly one row with one column.

To filter by a category (e.g. only one country or platform), put the filter in the WHERE clause — do not SELECT the category column.

Select

count() AS value

Filters

WHERE name = 'app_started' AND country = 'France'

To display a ratio as a percentage (e.g. “what % of users who started level 1 completed level 5?”), return two columns: a value column (the numerator) and a total column (the denominator). The frontend computes value / total and renders it as a percentage.

Select

uniqExactIf(identity, name = 'level_5_completed') AS value,
uniqExactIf(identity, name = 'level_1_started') AS total

Filters

WHERE name IN ('level_1_started', 'level_5_completed')

Set Display format to percent and Unit to %.

Column name matching rules:

  • The value column must match one of: value, count, amount, sum, qty, val
  • The total column must match one of: total, base, all, records, denominator

Total unique users (simple mode)

Select: uniqExact(identity) AS value
Filters: WHERE name = 'app_started'


Total sessions (simple mode)

Select: count() AS value
Filters: WHERE name = 'app_started'


Average session duration — requires a subquery, use full query mode

SELECT formatReadableTimeDelta(avg(duration_minutes) * 60) AS value
FROM (
SELECT toFloat64((last_event - first_event) / 60) AS duration_minutes
FROM (
SELECT
session_id,
MIN(timestamp) AS first_event,
MAX(timestamp) AS last_event,
minIf(timestamp, name = 'app_started') AS app_started_ts
FROM {table}
GROUP BY session_id
)
WHERE app_started_ts = first_event
)

Conversion rate: level 1 → level 5 (simple mode)

Select:

uniqExactIf(identity, name = 'level_5_completed') AS value,
uniqExactIf(identity, name = 'level_1_started') AS total

Filters: WHERE name IN ('level_1_started', 'level_5_completed')
Display format: percentUnit: %