Search code examples
azure-application-insightskql

KQL query to filter unique ID with highest value


If my KQL query is returning this

ID Value
123 1000
123 50
456 100
456 1400

How can I get it to return only one result per ID, of which has the highest value, e.g.

ID Value
123 1000
456 1400

Solution

  • summarize

    datatable (ID:int, Value:int)
    [
         123    ,1000
        ,123    ,50
        ,456    ,100
        ,456    ,1400
    ]    
    | summarize max(Value) by ID
    
    ID max_Value
    123 1000
    456 1400

    Fiddle