Skip to main content

Quantiles

Quantiles

In addition to common aggregates, you may wish to look at the value of a metric within a certain band or quantile. In the example below, we can measure the P95 of a given measure using QUANTILE_CONT.


Using DuckDB aggregate function, you can easily calculate various quantiles.

Not on DuckDB?

If you are using a different OLAP engine to power your dashboard, simply use the correct function for quantile.

IE: Clickhouse quantile, Pinot percentile

Please review the reference documentation, here.

Examples


In this example we see the values of P95 and P99 are calculated using the following expressions:

  - name: p95_quantile_global_intensity
expression: QUANTILE_CONT(Global_intensity, 0.95)
format_d3: ".3f"
description: P95 of Global Intensity
- name: p99_quantile_global_intensity
expression: QUANTILE_CONT(Global_intensity, 0.99)
format_d3: ".4f"
description: P95 of Global Intensity

Demo

See this project live in our demo!