Skip to content

Box plot

The box plot widget summarizes the distribution of a metric rather than a single number. Each box shows five statistics — minimum, first quartile (Q1), median, third quartile (Q3), and maximum — so you can see spread, skew, and typical range at a glance.

Use it for:

  • Session-duration distribution (per platform, per version)
  • Spread of in-app purchase amounts
  • Any metric where the median and variance matter more than the total

Return one row per category with a label column plus five numeric columns in this order and meaning: minimum, Q1, median, Q3, maximum. Alias them clearly as min, q1, median, q3, max — the widget matches columns by these names and falls back to column order otherwise.

Use ClickHouse quantile() for the quartiles.

SELECT
platform,
min(d) AS min,
quantile(0.25)(d) AS q1,
quantile(0.5)(d) AS median,
quantile(0.75)(d) AS q3,
quantile(0.95)(d) AS max
FROM (
SELECT platform, session_id,
dateDiff('minute', min(timestamp), max(timestamp)) AS d
FROM {table}
WHERE name = 'app_started'
GROUP BY platform, session_id
)
GROUP BY platform

Result shape:

platformminq1medianq3max
steam04112465
ios0381852

For one overall box, return a constant label:

Select / full SQL: replace platform with 'Sessions' AS label and drop GROUP BY platform (keep the inner per-session computation).


Session duration spread per platform — see the full SQL above.

Purchase amount distribution

SELECT
'Purchases' AS label,
min(toFloat64(value.amount)) AS min,
quantile(0.25)(toFloat64(value.amount)) AS q1,
quantile(0.5)(toFloat64(value.amount)) AS median,
quantile(0.75)(toFloat64(value.amount)) AS q3,
quantile(0.95)(toFloat64(value.amount)) AS max
FROM {table}
WHERE name = 'purchase'