variancew
This page explains how to use the variancew aggregation function in APL.
variancew calculates the weighted sample variance when each row represents multiple observations. The weight gives the number of observations the row represents.
Usage
Syntax
APL
Parameters
expr: The numeric expression 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).GroupingColumn(optional): A column to group the results by.
Returns
Returns a real value representing the weighted variance of expr across the group. By default, the output column is named variancew_<expr>.
Use case examples
Weighted variance of latency
This example computes the weighted variance across pre-aggregated request latency buckets.
Query
APL
Output
| variancew_latency |
|---|
| 85.29411764705883 |