Returns the value associated with the maximum key. If multiple rows share the maximum key, one is chosen arbitrarily.
key: the numeric key used for ordering.
value: the value returned from the row with the maximum key.
Examples
table T = with
[| as Product, as Price, as Weight |]
[| "Widget A", 100, 2.5 |]
[| "Widget B", 150, 1.8 |]
[| "Widget C", 75, 3.2 |]
show summary "Product analysis" with
argmax(T.Price, T.Product) as "Most Expensive"
argmax(T.Weight, T.Product) as "Heaviest"
Output:
Most Expensive
Heaviest
Widget B
Widget C
Remarks
When multiple rows share the same maximum key, the returned value is arbitrary. Reordering rows can change the result in tie cases.