Contribute in GitHub:
Edit online

# varianceif() (aggregation function)

Calculates the variance of *Expr* in records for which *Predicate* evaluates to `true`

.

## Syntax

`varianceif`

`(`

*Expr*`,`

*Predicate*`)`

## Arguments

Name | Type | Required | Description |
---|---|---|---|

Expr |
string | ✓ | Expression that will be used for aggregation calculation. |

Predicate |
string | ✓ | Predicate that if 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

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

### Results

varianceif_x |
---|

850 |