Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF statement

Hello,

I am trying to display color in the column when a certain condition is met. I have the following IF statement in the Background Color in the Expression tab of the Chart Properties.

My condition is

If the status is Not Started and the Quarter has passed then display Red.

My IF statement is

IF(Status = 'Not Started' AND Now() > End_Quarter, RGB(255,0,0))

This does not give me the desired results.

I also have another condition

If Status is Started and End Quarter has passed and there is no Completion Date then display Red.

Any suggestions?

Thanks.

1 Solution

Accepted Solutions
MarcoWedel

QlikCommunity_Thread_133245_Pic5.JPG.jpg

QlikCommunity_Thread_133245_Pic6.JPG.jpg

hope this helps

regards

Marco

View solution in original post

13 Replies
ecolomer
Master II
Master II

Two comments:

- are you sure intern format for Now() > End_Quarter,  both in Date Format?

- the beguining of expression with a =

Not applicable
Author

Thanks for your response.

I did have the = before the expression.

My End_Quarter is 1,2,3,4, TBD etc.

I have the quarter as 1 which in date should be Mar 31, 2 which in date should be June 30 and so on.

Can you please suggest on how to get this working?

Thanks.

antoniotiman
Master III
Master III

You try to use Today() instead of Now()

Regards,

Antonio

MarcoWedel

Hi,

should work like you intended:

QlikCommunity_Thread_133245_Pic1.JPG.jpg

QlikCommunity_Thread_133245_Pic2.JPG.jpg

hope this helps

regards

Marco

Not applicable
Author

I tried Today and Now, same result, not the desired result. I think it is because of the format. How can I fix it? Thanks.

MarcoWedel

combination of your first and second condition:

QlikCommunity_Thread_133245_Pic3.JPG.jpg

QlikCommunity_Thread_133245_Pic4.JPG.jpg

hope this helps also

regards

Marco

antoniotiman
Master III
Master III

If your End_Quarter = 'Mar 31' or 'June 30' You use

Date(Today(),'MM/DD') > Date(Date#(End_Quarter,'MMM DD'),'MM/DD')

Not applicable
Author

Hi Marco,

Thank you for the help, I am trying to work with your example.

Since, I have the End_Quarter as a number 1, 2, 3 ,4, does that compare to Now()?

Thanks.

davidwhite
Partner - Contributor III
Partner - Contributor III

It is best to not use Now() as it recalculates every second. Use Today().