Aggregate FunctionsArg
arg_min
Returns both the minimum value and the corresponding return expression from the row where the first expression is minimum.
Output column naming follows Microsoft Kusto:
- The single alias (or the source column name if unaliased) is used only for the key column.
loser = arg_min(score, name)→ columnsloser:long,name:string. - Each value column is named after the underlying source column when the
expression is a plain column reference or a simple unary call
(
todouble(v),bin(v, 1)→v); otherwise it is namedmin_<keyname>_arg<N>(1-based value-arg index). - Tuple assignment names each output column explicitly:
(min_score, loser) = arg_min(score, name)→min_score:long,loser:string. *expands to every non-key column with its own name and type.
Duplicate names across multiple aggregates are disambiguated by appending 1, 2, …:
arg_max(score, name), arg_min(score, name) → score, name, score1, name1.
Output column types match the inferred types of each argument expression.
Syntax
arg_min(minimize, return_expr)Parameters
Prop
Type
Returns: any
Syntax
arg_min(minimize, return_expr)Parameters
Prop
Type
Returns: any
Examples
Example 1
datatable(clan:string, warrior:string, voyages:long)[
"Lothbrok", "Ragnar", 42,
"Lothbrok", "Bjorn", 31,
"Fairhair", "Harald", 25,
"Lothbrok", "Ivar", 35
]
| summarize arg_min(voyages, warrior) by clan| clan (string) | voyages (long) | warrior (string) |
|---|---|---|
| Fairhair | 25 | Harald |
| Lothbrok | 31 | Bjorn |