Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlik88
Contributor
Contributor

Background colorization using IF AND

Hello,

I am trying to write a function that would do background colorization, for example:

1. If the attribute value is more than 0.98, color the cells red

2. If the attribute value is more than 0.85 and less than 0.98, color the cells orange

I wrote this:

if([attribute] > 0.85 and [attribute] < 0.98,'orange', if([attribute] > 0.98, 'red', 'white'))

The first part of the function to color the cells orange is not working, I am only getting red color. I made some tests and basically Qlik is not taking into account my function when I write "AND". 

 

Does someone have any idea how to do it? Should be simple but I couldn't find an answer online.

Thanks in advance!

 

Labels (1)
1 Reply
sarafoster
Contributor
Contributor

It seems that the issue may be related to the syntax used in your function. In Qlik, the correct syntax for using the logical operator AND is to use the symbol "&" instead of "and".    HomeBargains.co.uk

Try updating your function to the following:

if([attribute] > 0.85 & [attribute] < 0.98,'orange', if([attribute] > 0.98, 'red', 'white'))

This should properly evaluate the logical operator AND and apply the orange color to cells where the attribute value is between 0.85 and 0.98.