I want to enumerate how many times an event occurs consequently without a break, if it breaks, the count will restart from the beginning, for example input Date and Event, the Count should be:
| Date | event| Count |
| ---- | -----| ----- |
| 1 | A | 1 |
| 2 | A | 2 |
| 3 | B | 1 |
| 4 | A | 1 |
| 5 | B | 1 |
| 6 | B | 2 |
| 7 | B | 3 |
| 8 | A | 1 |
| 9 | A | 2 |
Does anyone have any idea how to solve this? Thanks
I tried the rank function, but it will continue to count the previous event when it occurs again.