Forum Discussion
yasirm
4 years agoFrequent Visitor
Streak count based on two columns
Hi,
I have a table with the following schema
| ID | Capacity | Load | Hour |
| 1 | 900 | 1100 | 0 |
| 1 | 900 | 1200 | 1 |
| 1 | 900 | 1200 | 2 |
| 1 | 900 | 300 | 3 |
| 1 | 900 | 200 | 4 |
| 1 | 900 | 100 | 22 |
| 1 | 900 | 1000 | 23 |
I would like to have another column which displays the streak count of each ID where Load>Capacity. The streak is based on Hour key. For the above example, my desired output will be this
| ID | Capacity | Load | Hour | Max Consecutive Over Loaded Hours |
| 1 | 900 | 1100 | 0 | 3 |
| 1 | 900 | 1200 | 1 | 3 |
| 1 | 900 | 1200 | 2 | 3 |
| 1 | 900 | 300 | 3 | 3 |
| 1 | 900 | 200 | 4 | 3 |
| 1 | 900 | 100 | 22 | 3 |
| 1 | 900 | 1000 | 23 | 3 |
Thank you in advance.
Ended up adapting the approach discussed here
https://community.powerbi.com/t5/Desktop/Build-measure-or-column-to-show-a-streak-by-consecutive-dates-a/m-p/899915
1 Reply
- yasirmFrequent Visitor
Ended up adapting the approach discussed here
https://community.powerbi.com/t5/Desktop/Build-measure-or-column-to-show-a-streak-by-consecutive-dates-a/m-p/899915