Berserk Docs
Aggregate FunctionsStatistical

covariancepif

Calculates the population covariance of two numeric expressions over the rows for which the predicate is true.

Syntax

covariancepif(x, y, predicate)

Parameters

Prop

Type

Returns: real

Examples

Example 1 — Population covariance of the multiples of three

range x from 1 to 100 step 1
| extend y = iff(x % 2 == 0, x * 2, x * 3)
| summarize covariancepif(x, y, x % 3 == 0)
covariancepif_x_y (real)
2077.090909090909

On this page