Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating Base Colors For A Block Chart

I would like to assign colors in a block chart based on a completion %. I am trying to calculate the base color using an "if" statement. QV seems to be ignoring the "if" statement and is using the "fixed color" that is assigned.

1 Reply
Not applicable
Author

I believe this can be done, I had a similar question answered this morning regarding setting colours in charts. Adding a condition was just an easy touch once I had the idea/code from John WItherspoon.

This is the link to my post - There is a file uploaded by John that I found helpful to determine coding colours.

http://community.qlik.com/forums/p/26208/100548.aspx#100548

So as you can see you can set your colours using the

pick(match("Bus Grp",'AA','AFAP',...),blue(),red(),...)

This can then be preceded by an 'If' statement and inserted into the Background Colour field of your expression.

If([Profit]>0, pick(match("Bus Grp",'AA'),green(),pick(match("Bus Grp",'AA'),red())

Hope this helps.

Edit - I can see my solution becoming very messy with multiple fields. I use 7 different 'Bus Grp's and repeating the 7 in each If,Then,Else combo does get to be a long string of code... Is there someway to simplify?