Forum Discussion
Flag Consecutive Values
- 6 years ago
Hi numersoz ,
Create a date column for your table:
Date = 'Table'[Time Stamp].[Date]Then you can use the following measure :
Measure = VAR t = SUMMARIZE ( 'Table', 'Table'[Time Stamp],'Table'[Date],'Table'[Value], "aa", IF ( 0 IN CALCULATETABLE ( VALUES ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Time Stamp] >= EARLIER ( 'Table'[Time Stamp] ) - 1 / 8 && 'Table'[Time Stamp] <= EARLIER('Table'[Time Stamp] ) && 'Table'[Date] = EARLIER('Table'[Date]) ) ), 1, 0 ) ) RETURN IF ( COUNTX ( FILTER ( t, [aa] = 0 &&COUNTROWS(t)>=4),[aa]) > 0, "flagged", "unflagged" )Please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ERoNh4-nNQpEufq-8Nl3glIBjc0tCc3J6tF3UMOUVpSkUQ?e=otD0UZ
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi numersoz ,
Would you please inform us more detailed information( your data(by OneDrive for Business)) if possible? Then we will help you more correctly.
Please do mask sensitive data before uploading.
Thanks for your understanding and support.
Best Regards,
Dedmon Dai
Hi, v-deddai1-msft
Thank you for your support. Please see below a dummy data for 2 days of time stamp.
For each day, I want to flag when value is between 1-20%. Within any day, if there are four consecutive values that has the flag of being between 1-20%, I need to flag that day.
This way instead of looking into hunders of days, I know that I have a problem in that day and it needs to be looked at.
Thanks
| Time Stamp | Value |
| 1/1/2019 0:00 | 0% |
| 1/1/2019 1:00 | 2% |
| 1/1/2019 2:00 | 2% |
| 1/1/2019 3:00 | 5% |
| 1/1/2019 4:00 | 0% |
| 1/1/2019 5:00 | 5% |
| 1/1/2019 6:00 | 5% |
| 1/1/2019 7:00 | 0% |
| 1/1/2019 8:00 | 6% |
| 1/1/2019 9:00 | 90% |
| 1/1/2019 10:00 | 60% |
| 1/1/2019 11:00 | 1% |
| 1/1/2019 12:00 | 0% |
| 1/1/2019 13:00 | 2% |
| 1/1/2019 14:00 | 5% |
| 1/1/2019 15:00 | 5% |
| 1/1/2019 16:00 | 6% |
| 1/1/2019 17:00 | 0% |
| 1/1/2019 18:00 | 0% |
| 1/1/2019 19:00 | 0% |
| 1/1/2019 20:00 | 7% |
| 1/1/2019 21:00 | 8% |
| 1/1/2019 22:00 | 9% |
| 1/1/2019 23:00 | 9% |
| 1/2/2019 0:00 | 0% |
| 1/2/2019 1:00 | 1% |
| 1/2/2019 2:00 | 1% |
| 1/2/2019 3:00 | 1% |
| 1/2/2019 4:00 | 1% |
| 1/2/2019 5:00 | 0% |
| 1/2/2019 6:00 | 1% |
| 1/2/2019 7:00 | 1% |
| 1/2/2019 8:00 | 1% |
| 1/2/2019 9:00 | 0% |
| 1/2/2019 10:00 | 0% |
| 1/2/2019 11:00 | 0% |
| 1/2/2019 12:00 | 5% |
| 1/2/2019 13:00 | 5% |
| 1/2/2019 14:00 | 6% |
| 1/2/2019 15:00 | 0% |
| 1/2/2019 16:00 | 80% |
| 1/2/2019 17:00 | 89% |
| 1/2/2019 18:00 | 9% |
| 1/2/2019 19:00 | 99% |
| 1/2/2019 20:00 | 9% |
| 1/2/2019 21:00 | 0% |
| 1/2/2019 22:00 | 0% |
| 1/2/2019 23:00 | 9% |
| 1/3/2019 0:00 | 9% |