Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
sspawar88
Creator II
Creator II

Variables for Color Condition

Hi Community,

In my Database below table is there and i'm using bar chart for different dimension.

suppose certain bar's value is 6 then it has to show amber color and different condition for others as well.

But this below table in database could change this value at any time.

How can i Hold that change in my app?

Should i use variable ? if yes can you please explain How ?

@ !

Color

Value fromValue To
Amber58
Red912
Green1316
Yellow1820
6 Replies
MayilVahanan

HI

Try like this

VariableName = if(YourExp >=5 and YourExp <= 8, Amber,

     If(YourExp <=12, Red,

     if(YourExp <=16, Green,

     if(YourExp >=18 and YourExp <=20, Yellow))))

Then use that variable in your expression background color.

Or,

You can use intervalmatch, but it depends on your data model and table structure

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable

Hi Satish,

you can add it as a calculated dimension whereby you will have an if statement.

Something like: if([value from] > 5 and [value from] <= 8, RGB([amber color code]),

                              if[value from] > 9 and [value from] <= 12, RGB([red color code])

                         ), etc

You can also have the above as a background colour in an expression

jagan
Luminary Alumni
Luminary Alumni

HI,

Try Interval Match and get the color code into your table, now based on color value apply the colors using RGB

IntervalMatch

If(Color= 'Red', Red(),

     If(Color='Green', Green(),

    If(Color='Yellow', Yellow(),

    If(Color='Amber', RGB(255, 194, 0))))

Hope this helps you.

Regards,

Jagan.

sspawar88
Creator II
Creator II
Author

but if that value will be change in next reload then can it help me

jagan
Luminary Alumni
Luminary Alumni

Yes, IntervalMatch() will take the range dynamically based on the from and To values dynamically.

Regards,

jagan.

sspawar88
Creator II
Creator II
Author

I'm searching but not understanding well..Can You please elaborate that Intervalmatch in my background color expression so that if that values in table i.e Value from, value to.. is change then it will not take efforts to change it every time in Expression.