QUANTILE_CONT() GROUP BY ...
All functions > GROUP BY > QUANTILE_CONT() GROUP BY ...
Returns the continuous quantile of the group at the given probability in (0, 1); result type is DOUBLE for numeric inputs and matches the expression type for DATE or TIMESTAMP.
Syntax
QUANTILE_CONT(expr, quantile) [ FILTER (WHERE condition) ] [ GROUP BY feature [, feature ...] ]
Notes
- NULL values are ignored where the underlying aggregate skips NULLs
- Can be used with FILTER (WHERE condition) and GROUP BY like other aggregates
- quantile uses DOUBLE (for example 0.5e0 for the median along the continuous definition)
Examples
FeatureQL
SELECT
-- Continuous 0.5 quantile over one group
f1 := ZIP(ARRAY(1, 1, 1) AS g, ARRAY(1e0, 2e0, 3e0) AS x).TRANSFORM(
SELECT QUANTILE_CONT(x, 0.5e0) GROUP BY g
).UNWRAP_ONE()
;Result
| f1 DECIMAL |
|---|
| 2.0 |