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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Loeckli
Contributor III
Contributor III

Color Coding with Conditional Statement

Hello Everyone

I'm struggeling to find the a good solution to my desired out put.

In general I would like to color code  the different groups of types, if the variable vColorPoints is On.

The following lines of code would do the trick:

if(vColorPoints='On' and Type='Bike', red())

if(vColorPoints='On' and Type='Car', Black())

I'm struggeling to find a one liner for a more genaral approach 

 Thank you

Labels (5)
1 Solution

Accepted Solutions
Or
MVP
MVP

What would be a more general approach to "Bikes are red, cars are black"? There's no inherent color to the type, near as I can tell.

Generally, the approach to coloring dimension values in Qlik Sense is to use the Master Item value colors.

A more robust approach to spelling out the values it to use Pick/Match instead of an if() statement:

Pick(Match(Type,'Car','Bike'),Red(),Black())

View solution in original post

4 Replies
Chirantha
Support
Support

Please see if this works

 

if(vColorPoints='On', if(Type='Bike', red(), if(Type='Car', black())))
 

Or
MVP
MVP

What would be a more general approach to "Bikes are red, cars are black"? There's no inherent color to the type, near as I can tell.

Generally, the approach to coloring dimension values in Qlik Sense is to use the Master Item value colors.

A more robust approach to spelling out the values it to use Pick/Match instead of an if() statement:

Pick(Match(Type,'Car','Bike'),Red(),Black())

Loeckli
Contributor III
Contributor III
Author

Thank you very much this approach worked for me 

Loeckli
Contributor III
Contributor III
Author

Thank you for show me new ways, to implement this. But how would this work if I want to implement something like on and off button which colors the types, over the master item ?