Forum Discussion
Anonymous
3 years agoNot applicable
Dynamic Running Count based on Year
Hi guys,
I have the challenge below of running count based on filter
for example: I need to build the measure COUNT to count the codes as below:
| CODE | YEAR | COUNT |
| A | 2019 | 1 |
| B | 2019 | 2 |
| C | 2020 | 3 |
| D | 2022 | 4 |
| E | 2022 | 5 |
| F | 2022 | 6 |
| G | 2022 | 7 |
| H | 2022 | 8 |
Then if Year is selected in the filter I need to run that count over again from 1
FILTER YEAR: 2022
| CODE | YEAR | COUNT |
| D | 2022 | 1 |
| E | 2022 | 2 |
| F | 2022 | 3 |
| G | 2022 | 4 |
| H | 2022 | 5 |
is that possible?
Thanks in advance
3 Replies
- Jihwan_KimSuper User
Hi,
Please check the below picture and the attached pbix file.
Count measure: = IF ( HASONEVALUE ( Data[CODE] ), COUNTROWS ( FILTER ( ALLSELECTED ( Data ), Data[CODE] <= MAX ( Data[CODE] ) ) ) )- AnonymousNot applicable
Thanks for getting back to me
I forgot to mention one point, what if I have duplicated codes?
Thanks!
- Ashish_MathurSuper User
Hi,
Please share your revised dataset and show the expected result clearly.