Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Calculating time difference between event rows based on filters

Hi,   I have the following data structure. (Monitoring Icinga2) Object ID represents some IT Object, a Server for example State_Time is the time where an event was recognized Current_State is th...
  • v-yulgu-msft's avatar
    8 years ago

    Hi Anonymous,

     

    Please try this:

    last_state_time =
    CALCULATE (
        MAX ( 'icinga icinga_statehistory'[state_time] ),
        FILTER (
            ALLEXCEPT (
                'icinga icinga_statehistory',
                'icinga icinga_statehistory'[Object_ID]
            ),
            'icinga icinga_statehistory'[state_time]
                < EARLIER ( 'icinga icinga_statehistory'[state_time] )
        )
    )

     

    Best regards,

    Yuliana Gu