Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

paulyeo11
Valued Contributor II

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
Valued Contributor

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

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

3 Replies
paulyeo11
Valued Contributor II

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

Enclosed My QS Doc

brunobertels
Valued Contributor

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

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
Valued Contributor II

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

Hi Bruno

Thank you very much it work fine.

Paul

Community Browser