Aggregate FunctionsStatistical
sumif
Calculates the sum of values in the group for which the predicate evaluates to true.
Syntax
sumif(val, predicate)Parameters
Prop
Type
Returns: long
Syntax
sumif(val, predicate)Parameters
Prop
Type
Returns: long
Syntax
sumif(val, predicate)Parameters
Prop
Type
Returns: real
Examples
Example 1
datatable(warrior:string, voyages:long, elite:bool)[
"Ragnar", 42, true,
"Bjorn", 31, true,
"Floki", 12, false,
"Ivar", 35, true,
"Harald", 25, false
]
| summarize sumif(voyages, elite)| sumif_voyages (long) |
|---|
| 108 |
Example 2
datatable(region:string, raid:string, silver:long, successful:bool)[
"England", "Lindisfarne", 500, true,
"Francia", "Paris", 7000, true,
"England", "York", 1200, false,
"Francia", "Rouen", 3000, true
]
| summarize sumif(silver, successful) by region| region (string) | sumif_silver (long) |
|---|---|
| England | 500 |
| Francia | 10000 |