Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

color expression for date

I need expression for date please, like:

green color = 2 months or above

red color = expired

yellow color = 1 month or less

like the following:

Color Measures

Untitled.png

6 Replies
Frank_Hartmann
Master II
Master II

can u provide sample qvw?

Anonymous
Not applicable
Author

Hi Mr. Frank,

find the attached file please.

vishsaggi
Champion III
Champion III

May be this?

Attached.

Anonymous
Not applicable
Author

vishsaggi‌ I can't open the file because I don't have a license, can you please copy & paste the expression here !

Best regards

hemanthaanichet
Creator III
Creator III

Go to expression tab

expand the +

background color

Apply the below expression

=IF([Contract Validity] >= Date(AddMonths(Today(),2), 'MM/DD/YYYY'), RGB(0,202,101), IF(Year([Contract Validity]) <Year(Today()), LightRed(), IF([Contract Validity] < Date(AddMonths(Today(),1), 'MM/DD/YYYY'), Yellow())))

vishsaggi
Champion III
Champion III

In your expression tab - Background Color, use below:

= IF(Year([Contract Validity]) < Year(Today()), LightRed(),

  IF([Contract Validity] >= Date(AddMonths(Today(),2), 'MM/DD/YYYY'), RGB(0,202,101),

  IF([Contract Validity] < Date(AddMonths(Today(),1), 'MM/DD/YYYY'), Yellow())))