Forum Discussion
DAX IF OR Measure not working based on criteria
- 3 years ago
Anonymous
You haven't given the Criteria to the IF statement.
Since you have more than 1 criteria, it may be easier to use a SWITCH:
keep the top part of your measure, but change the RETURN to:
RETURN
SWITCH( TRUE(),SELECTEDVALUE(Table[Worktype] )= "RM" && SELECTEDVALUE([MEUCOMPLIANCEIMPACT] )= 1 , _A,
SELECTEDVALUE(Table[Worktype] )= "RMST" && SELECTEDVALUE([MEUCOMPLIANCEIMPACT]) = 0 , _B)
Since it's a measure, you'll need to aggregate the Worktype and MEUCOMPLIANCEIMPACT columns in some way. I chose SELECTEDVALUE, but you could use MAX or SUM depending on how you want it to work.
Hi
No luck with the max and here is the sample data
Sample Data
| Count | Worktype | Status | MEUCOMPLIANCEIMPACT |
| 1 | RW | PPM | 0 |
| 1 | RW | PPM | 0 |
| 1 | RW | PPM | 0 |
| 1 | RW | PPM | 0 |
| 1 | REMST | PPM | 0 |
| 1 | REMST | PPM | 0 |
| 1 | REMST | PPM | 0 |
| 1 | REMST | PPM | 0
|
Anonymous
That doesn't look like the raw data, as there are no dates and the 'count' should be a measure, but if you want to use it in a card you need to provide the context within the measure.
Try this: