Berserk Docs
Aggregate FunctionsStatistical

covarianceif

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

Syntax

covarianceif(x, y, predicate)

Parameters

Prop

Type

Returns: real

Examples

Example 1 — Sample 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 covarianceif(x, y, x % 3 == 0)
covarianceif_x_y (real)
2142.0

On this page