Summarize
summarize
Groups rows by one or more key columns and computes aggregations over each group.
Spec
... | summarize <aggregation> [, ...] [by <group_column> [, ...]] Parameters
aggregation - An aggregate function call, optionally aliased (e.g. total = count()).
group_column - A column or expression to group by. Return Value
One row per unique combination of group columns. Output contains the group columns
and the aggregation result columns. Example
datatable(Service:string, Latency:int64)
[
"web", 10,
"web", 20,
"api", 5,
"api", 15
]
| summarize avg(Latency), count() by Service | Service | avg_Latency | count |
|---|---|---|
| web | 15 | 2 |
| api | 10 | 2 |
Summarize without grouping returns a single row:
range val from 1 to 5 step 1
| summarize sum(val), count() | sum_val | count |
|---|---|
| 15 | 5 |