Примітка
Доступ до цієї сторінки потребує авторизації. Можна спробувати ввійти або змінити каталоги.
Доступ до цієї сторінки потребує авторизації. Можна спробувати змінити каталоги.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Calculates the sample covariance of two random variables expr1 and expr2 in records for which predicate evaluates to true
.
Null values are ignored and don't factor into the calculation.
The following formula is used:
Note
This function is used in conjunction with the summarize operator.
Syntax
covarianceif(
expr1 ,
*expr2 ,
predicate)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
expr1 | real |
✔️ | First random variable expression. |
expr2 | real |
✔️ | Second random variable expression. |
predicate | string |
✔️ | If predicate evaluates to true , values of expr1 and expr2 will be added to the covariance. |
Returns
Returns the covariance value of expr1 and expr2 in records for which predicate evaluates to true
.
Example
The example in this section shows how to use the syntax to help you get started.
This query calculates the covariance of x and y for the subset of numbers where x is divisible by 3.
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)
Output
covarianceif_x_y |
---|
2142 |