Forum Discussion
Idenfity peak
- 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.
Hi, Ana_Cardoso
Based on your description, I created data to reproduce your scenario.
Data:
You may create a measure as below.
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.
- Ana_Cardoso6 years agoFrequent Visitor
Hi, I've tried all the suggestions but none is what i need.
I bring more informantion in order to try explain better what I want to count. First a table with samples of my data with a column "Alarm" wich is what I'm looking foward.Data Hora Tag Value Alarm 03/04/2020 03:40 Tag 1 10 0 03/04/2020 03:41 Tag 1 12 0 03/04/2020 03:42 Tag 1 60 1 03/04/2020 03:43 Tag 1 65 0 03/04/2020 03:44 Tag 1 30 0 03/04/2020 03:45 Tag 1 25 0 03/04/2020 03:46 Tag 1 59 1 03/04/2020 03:47 Tag 1 40 0 03/04/2020 03:48 Tag 1 2 0 03/04/2020 03:49 Tag 1 1 0 03/04/2020 03:43 Tag 2 49 0 03/04/2020 03:44 Tag 2 55 1 03/04/2020 03:45 Tag 2 59 0 03/04/2020 03:46 Tag 2 10 0 And an image where I put circles on the alarms.
It is continuos data. So, I have to count when I had a peak above 50 not the number of samples wich [Value] >=50.
- v-alq-msft6 years agoCommunity Support
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.
- Ana_Cardoso6 years agoFrequent Visitor
Hi, v-alq-msft It was just what I needed. It works perfectly.
Thanks for the help.
Regards,Ana