Forum Discussion

Ana_Cardoso's avatar
Ana_Cardoso
Frequent Visitor
6 years ago
Solved

Idenfity peak

Hello all,  I have a dataset with Timestamp, TagName and KPIValue of multiple tags. And I need to count "alarms" that is when I had a peak on a curve by TagName. My alarm trigger is KPIValue >= 50. ...
  • v-alq-msft's avatar
    v-alq-msft
    6 years ago

    Hi, Ana_Cardoso 

     

    Based on your description, you may create two measures as below.

     

     

    Alarm =
    var _currentvalue = SELECTEDVALUE('Table'[Value])
    var _currentdatetime = SELECTEDVALUE('Table'[Data Hora])
    var _currenttag = SELECTEDVALUE('Table'[Tag])
    var _lastvalue =
    CALCULATE(
    MAX('Table'[Value]),
    FILTER(
    ALLSELECTED('Table'),
    'Table'[Tag] = _currenttag&&
    'Table'[Data Hora] =
    CALCULATE(
    MAX('Table'[Data Hora]),
    FILTER(
    ALLSELECTED('Table'),
    'Table'[Tag] = _currenttag&&
    'Table'[Data Hora]<_currentdatetime
    )
    )
    )
    )

    return
    SUMX(
    'Table',
    IF(
    ISFILTERED('Table'[Data Hora]),
    IF(
    _lastvalue<50&&
    _currentvalue>50,
    1,
    0
    )
    )
    )

     

    Count =
    SUMX(
    'Table',
    [Alarm]
    )

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.