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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Color Expression by Year (If Statements)

I am trying to create and If statement that allows me to use the color expression function to color by specific year. I have come close to a solution, but not as I'd like it to be. (color codes are just examples)


This gets me a color for the first year, and all other years get the second. Its a start.

if([Service Year] = 2017, argb(255,1,149,189), argb(255,1,179,169))

What I'd like to see is:

IF([Service Year] = 2017, argb(255,1,149,189),


IF[Service Year] = '2016', argb(255,1,179,169)),

IF([Service Year] = '2015', argb(255,40,39,171)),


Etc..

Has anyone tried something similar to this?


Thanks

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this

Pick(Match([Service Year], 2017, 2016, 2015), ARGB(255,1,149,189), ARGB(255,1,179,169), ARGB(255,40,39,171))

View solution in original post

3 Replies
Anil_Babu_Samineni
MVP
MVP

Try from your end and tell us how you are getting the combination of nested if statements

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar
MVP
MVP

Try this

Pick(Match([Service Year], 2017, 2016, 2015), ARGB(255,1,149,189), ARGB(255,1,179,169), ARGB(255,40,39,171))

Anonymous
Not applicable
Author

That worked!

Thank you!!