percentilesw_array
This page explains how to use the percentilesw_array aggregation function in APL.
percentilesw_array calculates multiple estimated weighted percentiles in a single aggregation when each row represents multiple observations. The weight gives the number of observations the row represents.
Usage
Syntax
APL
Parameters
expr: The numeric,datetime, ortimespanexpression to evaluate.weight: An integer expression representing the frequency weight for each record. Records with a weight less than or equal to0are skipped. Records with anullweight are counted once (weight1).p1, p2, ...: One or more percentile values between0and100(passed as separate arguments or as a dynamic array such aspack_array(50, 75, 99.9)).GroupingColumn(optional): A column to group the results by.
Returns
Returns an array of estimated percentile values corresponding to the requested percentiles. By default, the output column is named percentilesw_<expr>.
Use case examples
Multiple weighted latency percentiles
This example computes the p50, p75, and p99.9 weighted latencies across pre-aggregated request buckets.
Query
APL
Output
| pw |
|---|
[20, 20, 40] |
List of related aggregations
- percentilew: Calculates a single estimated weighted percentile.
- percentiles_array: Calculates multiple unweighted percentiles as an array.
- avgw: Calculates the weighted average of an expression.
- histogramw: Builds an estimated weighted histogram.