Forum Discussion
Ana_Cardoso
6 years agoFrequent Visitor
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. ...
- 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))))returnSUMX('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.
Greg_Deckler
6 years agoCommunity Champion
Not 100% sure on this, sample source data would be greatly valuable. It sounds like you need to SUMMARIZE your data by timestamp and then FILTER for >=50?
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490