avg() (aggregation function)
Calculates the average (arithmetic mean) of Expr across the group.
Note
This function is used in conjunction with the summarize operator.
Syntax
avg (Expr)
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| Expr | string | ✓ | 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
Results
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 |
| ... | ... |
Feedback
Submit and view feedback for