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

Creating a Light Graph with dates expressions

Hello eveyone,

I am working on a project where i need create a semaphore graph which alternate the color depending on the results of the conditions below:

1) If the "Expected Date" minus today's date is less than 3 months, the light should be green;

2) If the "Expected Date"  minus today's date is greater than 3 monhts, the light should be yellow;

3) If the "Expected Date" minus today's date is greter than today's date, the light should be red;

"Expected Date" is a date field from my database (i.e 18/03/2018);

I'm not sure if I can do subtraction operations using dates on QlikView.

How should be my expression to make this works on QlikView?

Regards,

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Rodrigo, I assume you are using a traffic light gauge in a chart.

If so, maybe let the expression return numbers instead of color codes

=If( [Expected Date]- Today() <90, 1, If([Expected Date] <Today() , 3,2 )

Then set min and max to e.g. 0 and 3.

Disable autowidth segments and set lower bound to e.g. 0,2 and 3 for each segment.

View solution in original post

8 Replies
sunny_talwar

Dates are dual (meaning they are both text and number) so you can perform subtraction on dates.

If(AddMonths(Today(), -3) - [Expected Date] < 0, Green(),

If(AddMonths(Today(), -3) - [Expected Date] > 0 and Today() > [Expected Date], Yellow(), Red()))

swuehl
MVP
MVP

SET DateFormat = 'DD/MM/YYYY';

Then you should be able to just subtract dates, like

=If( [Expected Date]- Today() <90, Yellow() )

Not applicable
Author

The graph is asking for a Minimum and Max values, what should be added into this propertie?

Thanks

sunny_talwar

Which chart are you working with?

swuehl
MVP
MVP

Rodrigo, I assume you are using a traffic light gauge in a chart.

If so, maybe let the expression return numbers instead of color codes

=If( [Expected Date]- Today() <90, 1, If([Expected Date] <Today() , 3,2 )

Then set min and max to e.g. 0 and 3.

Disable autowidth segments and set lower bound to e.g. 0,2 and 3 for each segment.

Not applicable
Author

Im working with this chart:

Capturar.PNG

MarcoWedel

Hi,

maybe something like this:

QlikCommunity_Thread_210382_Pic1.JPG

QlikCommunity_Thread_210382_Pic2.JPG

QlikCommunity_Thread_210382_Pic3.JPG

hope this helps

regards

Marco

Not applicable
Author

Hi swuehl,

Thanks for your tip, with that expression the traffic light is working well.

One more question: How can i turn the light to grey when no filters are applied (E.G when the user click in Clear All filters)?

Thanks,