percentilew
Calculates a weighted percentile of a numeric column using DDSketch: each value counts as if it occurred `weight` times.
Rows whose weight is null or not positive are skipped. Use it on pre-aggregated data, such as a latency bucket and the number of requests that fell in it.
The estimate has the same 1% relative accuracy as percentile, and the same
caveats: an estimate can fall outside the observed range, and
percentilew(col, w, 0) is the exact minimum.
The variadic form mirrors KQL's percentilesw(col, weight, P1, P2, ...): one
output column per requested percentile, named percentile_<col>_<p> like
percentiles. The percentile argument is required.
Syntax
percentilew(val, weight)Parameters
Prop
Type
Returns: real
Syntax
percentilew(val, weight)Parameters
Prop
Type
Returns: real
Syntax
percentilew(val, weight, pct)Parameters
Prop
Type
Returns: real
Syntax
percentilew(val, weight, pct)Parameters
Prop
Type
Returns: real
Syntax
percentilew(val, weight, pct)Parameters
Prop
Type
Returns: dynamic
Syntax
percentilew(val, weight, pct)Parameters
Prop
Type
Returns: dynamic
Syntax
percentilew(val, weight)Parameters
Prop
Type
Returns: timespan
Syntax
percentilew(val, weight)Parameters
Prop
Type
Returns: timespan
Syntax
percentilew(val, weight, pct)Parameters
Prop
Type
Returns: timespan
Syntax
percentilew(val, weight, pct)Parameters
Prop
Type
Returns: timespan
Examples
Example 1 — Percentiles of latency recorded as bucket counts
datatable(ReqCount:long, LatencyBucket:long)[
8, 10,
6, 20,
3, 30,
1, 40
]
| summarize percentilesw(LatencyBucket, ReqCount, 50, 75, 99)| percentile_LatencyBucket_50 (real) | percentile_LatencyBucket_75 (real) | percentile_LatencyBucket_99 (real) |
|---|---|---|
| 19.886670240866184 | 19.886670240866184 | 40.0477705332636 |