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 built a DAX to color wrods with int a matrix under "Values". When I setup the condition it colors some but not all. See screenshot. You see some background are colored and not colored even though its same words. It appears to work for some but not all. Why would this be? How can I fix?
Dax code
Usage Risk Colors =
VAR Usage_Risk = SELECTEDVALUE('Key Table'[Usage_Risk])
RETURN
SWITCH(TRUE(),
Usage_Risk = "Unsupported/Not Allowed", "#E01920",
Usage_Risk = "Sunset", "#FAB131",
Usage_Risk = "Limited Use", "#FF5A00",
Usage_Risk = "preferred", "#7BBA00"
)
Solved! Go to Solution.
I was able to resolve this problem by changing the visualization to a Table instead of a Matrix
Hi @bman6074
Change
VAR Usage_Risk = SELECTEDVALUE('Key Table'[Usage_Risk])
to
VAR Usage_Risk = MAX('Key Table'[Usage_Risk])
And see if that makes a difference
It makes a difference but not the right colors
Hi @bman6074
SELECTEDVALUE was returning a second argument ( optional if multiple values occur ) witch in you case was not assigned and that's the reason for no color, now MAX is returning max value that obviously is not the one displayed in your table.
Is Usage risk in the screenshot table a Column or Measure?
I am still a bit New with Power bi and especially DAX coding. Not sure I totaly understand what your explaining.
The Usage Risk is a column. I do have a Measure called Usage Risk Colors.
I put the Usage Risk in values and then set a Backgorund condition using the measure.
Hi @bman6074,
Is Mitigation plan in the same table as Usage Risk?
Yes Mitigation Plan is in the same table as Usage Risk along wtih the Measures for each
The odd thing I discoverd is when I setup a Filter for Usage_Risk and Filter it to one of the RIsks. It then colors the cell.
You can see here EMA Correspondance shows no color wihtout filter. Once i filter it then shows correct color. and all are correctly colored for that risk.
if I select multiple in the filter it goes to back to the empty colors. Limited Use and Sunset seem to be the ones causing the problem. If I select Unsupported and Preferred together all are colored. I add in Limited User or Sunset I get empty colors for only Limited Use or Sunset.
I was able to resolve this problem by changing the visualization to a Table instead of a Matrix
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 |
---|---|
110 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |