Forum Discussion

abon13's avatar
abon13
Brass Contributor
Nov 15, 2023
Solved

Use of arg_max and arg_min together

Hi, I have a query which ultimately gives out all the info related to an IP address/ system. My current query is making use of arg_max, however I would also like to run arg_min. The final query resu...
  • Clive_Watson's avatar
    Clive_Watson
    Nov 16, 2023

    This is one way:

    let min_=Heartbeat
    | where TimeGenerated > ago(30m)
    | where Computer =="JBOX10"
    | summarize arg_min(TimeGenerated,ComputerIP, Computer)
    | extend Title_='min'
    ;
    let max_=Heartbeat
    | where TimeGenerated > ago(30m)
    | where Computer =="JBOX10"
    | summarize arg_max(TimeGenerated,ComputerIP, Computer)
    | extend Title_='max'
    ;
    union min_, max_
    | project TimeGenerated, ComputerIP, Computer, Title_

     

Resources