The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
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] ) ) )
)
Thanks for getting back to me
I forgot to mention one point, what if I have duplicated codes?
Thanks!
Hi,
Please share your revised dataset and show the expected result clearly.