variance() (aggregation function)

Learn how to use the variance() aggregation function to calculate the sample variance of the expression across the group.

Calculates the variance of expr across the group, considering the group as a sample.

The following formula is used:

Image showing a variance sample formula.

Syntax

variance(expr)

Parameters

NameTypeRequiredDescription
exprreal✔️The expression used for the variance calculation.

Returns

Returns the variance value of expr across the group.

Example

range x from 1 to 5 step 1
| summarize make_list(x), variance(x) 

Output

list_xvariance_x
[ 1, 2, 3, 4, 5]2.5