avg() (aggregation function)
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Calculates the average (arithmetic mean) of expr across the group.
Note
This function is used in conjunction with the summarize operator.
Syntax
avg(
expr)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
expr | string |
✔️ | The expression used for aggregation calculation. Records with null values are ignored and not included in the calculation. |
Returns
Returns the average value of expr across the group.
Example
This example returns the average number of damaged crops per state.
StormEvents
| summarize AvgDamageToCrops = avg(DamageCrops) by State
The results table shown includes only the first 10 rows.
State | AvgDamageToCrops |
---|---|
TEXAS | 7524.569241 |
KANSAS | 15366.86671 |
IOWA | 4332.477535 |
ILLINOIS | 44568.00198 |
MISSOURI | 340719.2212 |
GEORGIA | 490702.5214 |
MINNESOTA | 2835.991494 |
WISCONSIN | 17764.37838 |
NEBRASKA | 21366.36467 |
NEW YORK | 5.714285714 |
... | ... |