Berserk Docs
Aggregate FunctionsStatistical

variancepif

Calculates the population variance of values for which the predicate is true.

Syntax

variancepif(val, predicate)

Parameters

Prop

Type

Returns: real

Syntax

variancepif(val, predicate)

Parameters

Prop

Type

Returns: real

Examples

Example 1 — Population variance of voyages among the elite

datatable(warrior:string, voyages:long, elite:bool)[
  "Ragnar", 42, true,
  "Bjorn", 31, true,
  "Floki", 12, false,
  "Ivar", 35, true,
  "Harald", 25, false
]
| summarize variancepif(voyages, elite)
variancepif_voyages (real)
20.666666666666668

On this page