sum() (aggregation function)
Calculates the sum of Expr across the group.
Note
This function is used in conjunction with the summarize operator.
Syntax
sum (Expr)
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| Expr string | ✓ | Expression used for aggregation calculation. |
Returns
Returns the sum value of Expr across the group.
Example
This example returns the total number of deaths by state.
StormEvents
| summarize EventCount=count(), TotalDeathCases = sum(DeathsDirect) by State
| sort by TotalDeathCases
Results
The results table shown includes only the first 10 rows.
| State | event_count | TotalDeathCases |
|---|---|---|
| TEXAS | 4701 | 71 |
| FLORIDA | 1042 | 57 |
| CALIFORNIA | 898 | 48 |
| ILLINOIS | 2022 | 29 |
| ALABAMA | 1315 | 29 |
| MISSOURI | 2016 | 20 |
| NEW YORK | 1750 | 19 |
| KANSAS | 3166 | 17 |
| GEORGIA | 1983 | 17 |
| TENNESSEE | 1125 | 17 |
| ... | ... | ... |
Feedback
Submit and view feedback for