Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to make bar color > 36 % Yellow >33% Green >30% Org < 27% Red < 25% Black

Hi All

I am using QV , i insert below expression at sales expression blackground color , in order to make the bat reflect the GP% color :-

> 36 % Yellow >33% Green >30% Org < 27% Red < 25% Black

If(GP% > 0.36,Yellow(),

if(GP% > 0.3 and GP%<= 0.36,RGB(0,255,0),

if(GP% >0.27 and GP% <= 0.3,rgb(254,184,0),

if(GP% >0.25 and GP% <= 0.27,rgb(254,0,0),

If(GP% <= 0.25, rgb(0,0,0))))))

May i know where to insert the above script , so that it will have color on bar.

Paul

1 Solution

Accepted Solutions
brunobertels
Master
Master

Hi Paul

Try this and see if it works :

in color and legend panel

select color by expression

add this mesure :

if(

(sum(sales)-sum(cost))/sum(sales)<=0.36,RGB(0,255,0),

if(

(sum(sales)-sum(cost))/sum(sales)<=0.30,rgb(254,184,0),

if(

(sum(sales)-sum(cost))/sum(sales)<=0.27,rgb(254,0,0),

if(

(sum(sales)-sum(cost))/sum(sales)<=0.25,rgb(0,0,0),

yellow()))))

you may have this :

regards

View solution in original post

3 Replies
paulyeo11
Master
Master
Author

Enclosed My QS Doc

brunobertels
Master
Master

Hi Paul

Try this and see if it works :

in color and legend panel

select color by expression

add this mesure :

if(

(sum(sales)-sum(cost))/sum(sales)<=0.36,RGB(0,255,0),

if(

(sum(sales)-sum(cost))/sum(sales)<=0.30,rgb(254,184,0),

if(

(sum(sales)-sum(cost))/sum(sales)<=0.27,rgb(254,0,0),

if(

(sum(sales)-sum(cost))/sum(sales)<=0.25,rgb(0,0,0),

yellow()))))

you may have this :

regards

paulyeo11
Master
Master
Author

Hi Bruno

Thank you very much it work fine.

Paul