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: 
Anonymous
Not applicable

Multiple if statements under expression text color

Hello all,

I have a question regarding the use of multiple IF statements.

I am working with 7 product groups, that I am displaying in the same graph. I am using a list box to toogle between each, showing their sales number in the graph.

My question is regarding the feature "Text color" under expression.

I am trying to add different colors depending on which of the 7 products i choose. What I want to do is that sale numbers above xx (depending on the choosen product) are shown in green, and below this number are shown in red. As the sale numbers vary a lot between the 7 product groups the "cut-off" point should be different for each, hence the IF statement.

I tried with the following:

=if( [sales] >='500'  and [Product_Group] = '1',rgb(255,110,110),rgb(108,179,63),

if( [sales] >='500'  and [Product_Group] = '2',rgb(255,110,110),rgb(108,179,63),

if( [sales] >='500'  and [Product_Group] = '3 SW',rgb(255,110,110),rgb(108,179,63),

if( [sales] >='500'  and [Product_Group] = '4 5D',rgb(255,110,110),rgb(108,179,63),

if( [sales] >='500'  and [Product_Group] = '5',rgb(255,110,110),rgb(108,179,63),

if( [sales] >='500'  and [Product_Group] = '6',rgb(255,110,110),rgb(108,179,63),

if( [sales] >='500'  and [Product_Group] = '7',rgb(255,110,110),rgb(108,179,63)

)))))))

Again the reason for the IF statements is that the 500 should be different for each product.

I have only been using QlikView for less than a week, so I am sorry if my question and/or programmering is not very clear.

Thank you very much for your help!

Mathias

12 Replies
Anonymous
Not applicable
Author

Hey Ruben,

Alright good. I do understand your way of doing it now, and I will try with this. However, as you also write, overtime Julian's answer is most likely the best, as it is a lot less complicated.

Anonymous
Not applicable
Author

Overall I guess I could work with any of your answers. I will try them all out, and see what works best for me. Thank you all for the very fast and good responses!

julian_rodriguez
Partner - Specialist
Partner - Specialist

Good luck Mathias,

I'm glad than I could help you.

Regards!