Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
leocattqv
Creator
Creator

On Time v Overdue

Hi Everyone,

I am trying to calculate Records by comparing Today is Greater than (Less Than) a due date.  this is what I have, but Im getting errors.

Any suggestions?

if(Today()) > [Calculated Eval Due], 'Overdue', 'OnTime' as EVAL_ONTIME;

1 Solution

Accepted Solutions
Colin-Albert

try

if(Today() > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

View solution in original post

6 Replies
jpapador
Partner - Specialist
Partner - Specialist

Check your syntax:

if(Today() > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

should look like that, moved the ) from today to end of if statement

qliknerd
Contributor III
Contributor III

Hi Leo

you to need to close your if statement:

if(Today()) > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;





Colin-Albert

Can you check that [Calculated Eval Due] is a correctly formatted date?

The simplest way is to add the field to a listbox and see if the values are shown as dates or numbers, and whether  the data is left or right justified.

If shown as a date, but right justified, the value is correctly held as a dual field and will match the data returned by today()

If shown as a date but left justified, then the value is held as text and you will need to use something like

     Date(date#([Calculated Eval Due], 'DD/MM/YYYY'))  

replacing DD/MM/YYYY with your actual date format to convert the data to a correct date value.

If shown as a number then date([Calculated Eval Due]) should convert the data to a correct date format.

leocattqv
Creator
Creator
Author

Thanks guys,

I appreciate it, but it looks like the comma between [Calculated Eval Due] and 'Overdue' is the hangup.

if(Today()) > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

I apologize for the newbie question but this is stumping me.

thanks,

-L

Colin-Albert

try

if(Today() > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

leocattqv
Creator
Creator
Author

that did it,

thanks everyone.