Muokkaa

Jaa


sum() (aggregation function)

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Calculates the sum of expr across the group.

Null values are ignored and don't factor into the calculation.

Note

This function is used in conjunction with the summarize operator.

Syntax

sum(expr)

Learn more about syntax conventions.

Parameters

Name Type Required Description
expr string ✔️ The expression used for the aggregation calculation.

Returns

Returns the sum value of expr across the group.

Example

This example returns the total value of crop and property damages by state, and sorted in descending value.

StormEvents 
| summarize EventCount=count(), TotalDamages = sum(DamageCrops+DamageProperty) by State 
| sort by TotalDamages

Output

The results table shown includes only the first 10 rows.

State Eventcount TotalDamages
CALIFORNIA 898 2801954600
GEORGIA 1983 1190448750
MISSOURI 2016 1096887450
OKLAHOMA 1716 916557300
MISSISSIPPI 1218 802890160
KANSAS 3166 738830000
TEXAS 4701 572086700
OHIO 1233 417989500
FLORIDA 1042 379455260
NORTH DAKOTA 905 342460100
... ... ...