Forum Discussion
filter with multiple conditions
Hi all,
Stuck here.. Data looks like this:
| Ban | PTP | handled | D |
| 123 | 0 | y | 0 |
| 456 | 1 | y | 1 |
| 789 | 0 | y | 0 |
| 788 | 0 | y | 1 |
What i need to do is this: I want to count the bans with condition = Y and add the following 2 conditions...
D = 0 and ptp = 0
D = 0 and ptp =1
D = 1 and ptp = 1
Wht is the best way to create this measure ? I can't figure out the dax formula. Any guidance is appreciated. Thank you!
Hey,
I would create this measure:
Measure = var filtertable = UNION( ROW("handled" , "Y" , "D" , 0 , "ptp" , 0) , ROW("handled" , "Y" , "D" , 0 , "ptp" , 1) , ROW("handled" , "Y" , "D" , 1 , "ptp" , 1) ) return CALCULATE( COUNTROWS('Table') , TREATAS(filtertable , 'Table'[handled] , 'Table'[D] , 'Table'[PTP]) )Based on the sample data you provided, the measure returns 3 and can be used e.g. on a card visual like so:
Hopefully this is what you are looking for.
Regards,
Tom
3 Replies
- TomMartensSuper User
Hey,
I would create this measure:
Measure = var filtertable = UNION( ROW("handled" , "Y" , "D" , 0 , "ptp" , 0) , ROW("handled" , "Y" , "D" , 0 , "ptp" , 1) , ROW("handled" , "Y" , "D" , 1 , "ptp" , 1) ) return CALCULATE( COUNTROWS('Table') , TREATAS(filtertable , 'Table'[handled] , 'Table'[D] , 'Table'[PTP]) )Based on the sample data you provided, the measure returns 3 and can be used e.g. on a card visual like so:
Hopefully this is what you are looking for.
Regards,
Tom
- NOVICE02Helper III
Amazing!! Thank you so much , it worked!