'Finding greatest count of each distinct column value

Given a table like below, is it possible in Kusto get the row with the greatest count for each food?

Person Food NumEaten

a   cake    28
b   cake    6
c   cake    3
d   cake    2
e   cake    2
f   pie     117
g   pie     79
h   pie     41
i   pie     35

Result to achieve:

Person  Food    NumEaten

a   cake    28
f   pie     117
kql


Solution 1:[1]

You can use the arg_max() aggregation function or the partition operator. See similar post here: Get top 1 row of each group using Kusto

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yoni L.