Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am creating a measure to leverage for conditional formatting. However I'm running into something strange. I Created an IF statement to check two conditions. If both conditions are true, it should return a 1, otherwise a 0.
JobDistrict is one of the conditional fields, and is the top level of a hierarchy, with JobName as the second level. In my matrix, it must be drilled down to the JobName level. However, when I do that, I noticed something strange. The "Salad" JobName splits out to two columns. This is a problem because it is returning a 0 & blank, but this value should actually be a 1 because the conditions for JobDistrict and Est. Margin are met. I have confirmed that this is the only "Salad" JobName, but I'm not sure what else could possibly be causing this, as the others seem to be fine.
Does anyone know what's going on with this? Do i need to alter the measure?
Here's my measure
Format Margin = if(SELECTEDVALUE('dim Job'[JobDistrict])="South" && [Est. Margin]>=.122
||SELECTEDVALUE('dim Job'[JobDistrict])="West" && [Est. Margin]>=.310
||SELECTEDVALUE('dim Job'[JobDistrict])="Northeast" && [Est. Margin]>=.188
,1,0)
Solved! Go to Solution.
@Anonymous - It's difficult to say but I am concerned about your formula and whether it is implementing your logic correctly.
Format Margin = if( (SELECTEDVALUE('dim Job'[JobDistrict])="South" && [Est. Margin]>=.122)
|| (SELECTEDVALUE('dim Job'[JobDistrict])="West" && [Est. Margin]>=.310)
|| (SELECTEDVALUE('dim Job'[JobDistrict])="Northeast" && [Est. Margin]>=.188)
,1,0)
Try that and see if things clear up.
Hi @Anonymous
Due to I don't know your data model , so I build a sample table to have a test.
Build a measure
Est.Margin = SUM('dim Job'[Qty])/100
Then use your Format Margin Measure and build a Matrix.
However whether I delete the row with red box or change 0 to blank, my result in Matrix shows correctly as above.
I think your problem may be caused by your data model or your other measures in Matrix.
Could you show me your data model and provide me more details about your Est.Margin Measure?
Or you can share your pbix file with me by your Onedrive for Business.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous - It's difficult to say but I am concerned about your formula and whether it is implementing your logic correctly.
Format Margin = if( (SELECTEDVALUE('dim Job'[JobDistrict])="South" && [Est. Margin]>=.122)
|| (SELECTEDVALUE('dim Job'[JobDistrict])="West" && [Est. Margin]>=.310)
|| (SELECTEDVALUE('dim Job'[JobDistrict])="Northeast" && [Est. Margin]>=.188)
,1,0)
Try that and see if things clear up.
@Greg_Deckler Good catch, but that didn't resolve the issue. No idea what it could be doing. I've tried to come up with another way to leverage measures and columns but no luck.
@Anonymous - OK, but you don't actually need that measure in your visual, right? You just want to use it for conditional formatting?
@Anonymous - So what happens if you take it out of the visual and use it in your conditional formatting for your other measure/column, does it return the right value (color)?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |