Forum Discussion
jay13
1 year agoRegular Visitor
Countrows with filters
I am trying to count the rows for an ID where they only have a specific code. Example: If I am looking to count the IDs that only have code D how would I count just that row. In this case the cou...
- 1 year ago
Simple enough,
Gabry
1 year agoSuper User
Yeah, sure, I can try. You can use the DAX query view to help debug the code.
This part of the code:
FILTER (
VALUES ( Tabella[ID] ),
CALCULATE ( COUNTROWS ( FILTER ( Tabella, Tabella[code] <> "D" ) ) ) = 0
)
filters out all the IDs that have a code different from "D". It essentially says to keep only the rows where the count is 0.
Then, you just count the IDs in this filtered table with:
DISTINCTCOUNT ( Tabella[ID] )
and you'll get the number of IDs.
😉
jay13
1 year agoRegular Visitor
Thanks so much for the help!