Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sspawar88
Creator II
Creator II

Dynamic Background Expression

Hi Community,

Following Table is in my database. Requirement is to not make hardcore value in background color Expression because it may change at any time.

My Expression is sum(Discount)/Sum(Amount)*100

How can i make background color Expression such a way that if any values in FROM_VALUE or TO_VALUE will change then there will be no need to change in Development side.

Should i make variable for column FROM_VALUE or TO_VALUE?

RAGSTATUSFROM_VALUETO_VALUE
GREEN05
AMBER615
RED16100
2 Replies
Anonymous
Not applicable

Hi Satish,

try this

my code:

T1:

LOAD * INLINE [

    Region, orderDate, Product, Amount

    4, 1/4/2011, Case 4, 3

    5, 1/5/2011, Case 5, 20

    6, 1/4/2011, Case 4, 2

    7, 1/5/2011, Case 5, 40

    8, 1/2/2011, Case 5, 15

 

];

T2:

LOAD * INLINE [

RAGSTATUS, FROM_VALUE, TO_VALUE

GREEN, 0, 5

AMBER, 6, 15

RED, 16, 100

];

Dim:

orderDate

Exp:

sum(Amount)

background exp:

if(sum(Amount)>=Min(FROM_VALUE)and sum(Amount)<=min(TO_VALUE),rgb(154,205,50),

if(sum(Amount)>=Min(FROM_VALUE,2)and sum(Amount)<=min(TO_VALUE,2),rgb(255,165,0),rgb(255,0,0)))

output:

Img1.PNG

you just need to replace sum(Amount) with your exp sum(Discount)/Sum(Amount)*100

like:

if((sum(Discount)/Sum(Amount)*100)>=Min(FROM_VALUE)and (sum(Discount)/Sum(Amount)*100)<=min(TO_VALUE),rgb(154,205,50),

if((sum(Discount)/Sum(Amount)*100)>=Min(FROM_VALUE,2)and (sum(Discount)/Sum(Amount)*100)<=min(TO_VALUE,2),rgb(255,165,0),rgb(255,0,0)))

Regards,

Sandip Satbhai

Not applicable

Open the chart properties.
Go to Visual Cues tab.
Select the required expression, define the upper and lower limit and choose the desired color.