Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have a colour formatting switch like this:
LateColor =
var col = SELECTEDVALUE(DimLate[Lateness Group])
RETURN
SWITCH(
TRUE(),
col = "Early", "#2c7bb6",
col = "On Time", "#2c7bb6",
col = "Late", "#c80651",
col = "No date", "#000000",
"#000000"
)
It works, showing blue for early and on-time, and showing red for late
However, the great and almighty powers-that-be want to see red & green in their dashboards (antiquated, I know). As I know we have red-green colourblind people in our company, my thinking was to offer both options
What is the best way that I can add a switch measure so that my users can choose between "Traditional"(red/green) vs "Inclusive" (red/blue) colours by way of a radio button?
Solved! Go to Solution.
Hi @dapperscavenger ,
You can create a disconnected table with "Traditional" and "Inclusive" as rows. Use the field from that table in your slicer. Use SelectedValue to get the selected option. Then use If statement .
Something like this:
Measure=
var _SelectedColor= SELECTEDVALUE(DisconnectedTableName[FieldName])
return
If(_SelectedColor="Traditional", Do the red/green stuff here, Do the red/blue stuff here)
Hi @dapperscavenger ,
You can create a disconnected table with "Traditional" and "Inclusive" as rows. Use the field from that table in your slicer. Use SelectedValue to get the selected option. Then use If statement .
Something like this:
Measure=
var _SelectedColor= SELECTEDVALUE(DisconnectedTableName[FieldName])
return
If(_SelectedColor="Traditional", Do the red/green stuff here, Do the red/blue stuff here)
Thanks! This got me started in the right direction
I created a table containing the hex codes, so that in the future if I need to change the colour schemes I can do it for all the formulas in one go by just updating the table
(These are just test hex codes btw):
Added slicer to the visuals with single select only, for the View field
And then called the hex codes with below measure:
Measure =
var _ColPos = CALCULATE(MAX(DimColour[Positive]),FILTER(DimColour,SELECTEDVALUE(DimColour[View]) = DimColour[View]))
var _ColNeg = CALCULATE(MAX(DimColour[Negative]),FILTER(DimColour,SELECTEDVALUE(DimColour[View]) = DimColour[View]))
return
if( [MyOtherMeasure] <=0 ,_ColPos,_ColNeg))
User | Count |
---|---|
128 | |
108 | |
99 | |
65 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |