Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.49 KB

varianceif-aggregation-function.md

File metadata and controls

47 lines (32 loc) · 1.49 KB
title description ms.reviewer ms.topic ms.date
varianceif() (aggregation function)
Learn how to use the varianceif() function to calculate the variance in an expression where the predicate evaluates to true.
alexans
reference
11/13/2023

varianceif() (aggregation function)

Calculates the variance of expr in records for which predicate evaluates to true.

[!INCLUDE ignore-nulls]

[!INCLUDE data-explorer-agg-function-summarize-note]

Syntax

varianceif(expr, predicate)

[!INCLUDE syntax-conventions-note]

Parameters

Name Type Required Description
expr string ✔️ The expression to use for the variance calculation.
predicate string ✔️ If predicate evaluates to true, the expr calculated value will be added to the variance.

Returns

Returns the variance value of expr in records for which predicate evaluates to true.

Example

[!div class="nextstepaction"] Run the query

range x from 1 to 100 step 1
| summarize varianceif(x, x%2 == 0)

Output

varianceif_x
850