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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Colour Coding by Date

Id
Date
101/02/2012
201/03/2012
301/04/2012
.......

Hello,

I require some assistance!

I have the above dataset, the minimum date in 'Date' is '01/03/2003' and maximum date is '01/01/2021',

I have a rquirement to colour code each record against the Date Column,

Current Month = Red                                    (Feb 2012 at time of writing this)

Current Month+1 = Amber                             (Mar 2012 at time of writing this)

Anything greater Current Month+2 = Green     (Apr 2012 onwards at time of writing this)

Anything less than Current Month = Grey       (Jan 2012 backwards at time of writing this)

I understand this could be acheived through alot of nested if's, but was looking for a more elgant solution,

Any advice would greatly appreciated

1 Reply
Not applicable
Author

There are 2 ways you can do this:

1. Use nested if's in chart background color or text color

2. Add a field that carries the 'colorcode' in script (this would use nested if again). In this approach, all you have to do is add field name into chart background color or text color:

if(MonthName(Date)=MonthName(Today()),LightRed(),

if(MonthName(Date)=MonthName(Today(),1),yellow( ),

if(MonthName(Date)>=MonthName(Today(),2),LightGreen(),DarkGray()))) as ColorCode