Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I appreciate all the help I've gotten on here so far and all that is to come. I am working on a map visualization, where I color code portions of the United States various colors to show ranks in regard to health care. I have already imported my data and a KML file to display the states. I'm attaching screenshots of the map and the expression that I thought would work (but doesn't). Any insight into what's wrong would be amazing and thanks again in advance!
Sincerely,
Munna
Seems like you are missing all opening and closing parentheses with your if() functions.
if - script and chart function ‒ Qlik Sense
And the color functions should not be enclosed in single quotes.
Like
=If(Rank <10, Green(),
If(Rank < 20, Yellow(), Red() )
)
The expression syntax should be:
if(Rank<=10, springgreen(),
if(Rank>10 and Rank<=20, lightcyan(),
if(Rank>20 and Rank<=30, lightskyblue(),
if(Rank>30 and Rank<=40, lightsalmon(),
springgreen()
))))
(Notice Error in expression on the bottom of the screenshot)
I tried updating it but I'm not sure what else is wrong. I added double quotes and parentheses around my if functions. Thanks for the help!
What could I do to get rid of that error in expression at the bottom? I am still getting it after pasting your function in the expression editor.
The statement should logically look like
=If( Condition1, Then1, Else1)
or using nested statements:
=If(Condition1, Then1, // Else1 is another if()
If(Condition2, Then2, // Else2 is another if()
If(Condition3, Then3,Else3)
)
)
No quoting of functions (and you don't need to quote the numbers, too).
Because the colors you use, don't exists, except lightcyan() - at least in my version of Sense.
Try to use rgb() function instead.
Edit: here is the list of predefined colors: