I'm trying to switch the background color of a column base off two variables, one which is define by a selected value in (A) and other that is define by how the value of a column (B) is compare to a goal, it work just fine when there is a single value selected for (A) but when none or multiple values are selected on (A) it gives an error. I use the SELECTEDVALUE fuction and define an alternate value (1), this value (1) will be returned anytime there's more than a single value selected in field (A), but still it gives an error. Here's the code:
FormatinText =
VAR _FILTER= SELECTEDVALUE(A,1)
VAR _GreenColor = "#2dc937"
VAR _GreyColor = "#FFFFFF"
VAR _RedColor ="#cc3232"
VAR _BlackColor = "#00000"
VAR _KPI= IF([MEASURE]>VALUES(GOAl Value),1,0)
Return SWITCH(_FILTER,1,SWITCH(_KPI,1,_BlackColor,0,_BlackColor),1524,SWITCH(_KPI,1,_RedColor,0,_GreenColor),1526,SWITCH(_KPI,1,_RedColor,0,_GreenColor))
# 1524,1526 are values that can be selected on field (A)```
I tried using an IF statement but it did not work. I verify the expression was returning a single value when there was nothing on (A) and it did show only value "1" which is correct, as this is the alternate value define.