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 |
Calculates the variance of expr in records for which predicate evaluates to true
.
[!INCLUDE ignore-nulls]
[!INCLUDE data-explorer-agg-function-summarize-note]
varianceif(
expr,
predicate)
[!INCLUDE syntax-conventions-note]
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 the variance value of expr in records for which predicate evaluates to true
.
[!div class="nextstepaction"] Run the query
range x from 1 to 100 step 1
| summarize varianceif(x, x%2 == 0)
Output
varianceif_x |
---|
850 |