Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
BartoszW
Contributor
Contributor

Conditional colouring multiple Measures in one expression

Hi!

I've four different Master Measures that i would like to display in one Bar Chart.

All of them should be coloured based on avg value: if > 0 -> green, if <= 0 -> red.

I totally get how to do it for one measure, but to separately colour 4 of them in one expression is too much for me.

In best case i expect something like this to work, but it is not 😞

if(avg([VisitsVs2019])>0,green(),red())
if(avg([VisitsVs2020])>0,green(),red())
if(avg([VisitsVs2021])>0,green(),red())
if(avg([VisitsVs2022])>0,green(),red())

No idea if this is changing anything, but im using QuickCloud

Please help! 😉

Labels (3)
4 Replies
ajaykakkar93
Specialist III
Specialist III

Hi,

Simple if condition will be the below.

if(avg([YourField])>0,green(),
if(avg([YourField])>0,green(),
if(avg([YourField])>0,green(),
if(avg([YourField])>0,green(),red()
)))) // nested if condition

this condition should be in color expression of a table.

 

 

 

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

BartoszW
Contributor
Contributor
Author

Thank You Sir for suggestion!

I've checked it and i got message like that:

"Error in expression: if takes 2-3 parameters" and whole expression is listed.

And every column on Bar Chart is grayed out. Any idea why?

ajaykakkar93
Specialist III
Specialist III

Hi,

Please try the below, 
if(avg([VisitsVs2019])>0,green(),
if(avg([VisitsVs2020])>0,green(),
if(avg([VisitsVs2021])>0,green(),
if(avg([VisitsVs2022])>0,green(),red()
)))) // nested if condition

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

BartoszW
Contributor
Contributor
Author

It is not returning any errors, but all columns are now coloured green.

And column1 (VisitsVs2019) is below 0 so i would like it to be coloured red and next column2 (VisitsVs2020) as above 0 should be coloured green 😉

Once again thank You very much for You time ❤️