Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
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 90, color the cells red

2. If the attribute value is more than 75 and less than 90, color the cells orange

I wrote this:

if([attribute] > 75 and [attribute] < 90,'orange', if([attribute] > 90, '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 (2)
8 Replies
Clever_Anjos
Employee
Employee

Is attribute a field? Most probably you need to add some aggregation here (sum/count/etc)

qlik88
Contributor
Contributor
Author

Hello,

The attribute is just from the data manager but not used as a field in the table. Not sure how could I add aggregation?

Clever_Anjos
Employee
Employee

Are you planning to use this color expression where in your sheet? Table, KPI?

qlik88
Contributor
Contributor
Author

It's a table with columns and rows and a measure (SUM) that is populating the table cells. However, the table cells should have background colorization not based on the measure (SUM) that is showing in the cell but rather based on an attribute that is not present in the table, only in the data manager.

Clever_Anjos
Employee
Employee

Just for testing purpose, could you add two measures?

Sum([attribute]) and 

Avg([attribute]) 

qlik88
Contributor
Contributor
Author

Hello,

I added, it's still not working.

Clever_Anjos
Employee
Employee

Which values are you seeing on those columns?

I guess [attribute] is a number, right?

Frank_S
Support
Support

Hi @Hana88 

 

Check using this link of the chart you are using is supported for multi-colors.

https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Colors/color-method-visua...

 

Kind regards.

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!