Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
schneider2037
Creator
Creator

Today() calculation returning wrong # days

Using Today() in a script calculation in the data model that counts the # days from today to when a past start date for a help desk ticket. The Data Model is consistently returning the correct # days, but the Application (we build data model then binary load that model for the application) is not.


We run this on a server, and the Application is refreshing every morning, so while I recognize that today(), today(0), today(1), and today(2) all mean something different...in this case shouldn't they all return the same "date" from which to start the calculation?

0 Date at script run

1 Date at function call

2 Date when the document was opened


These all seem relative to the system clock...is there not (like Excel) a version that declares "Here is Today's Date?"


Thanks!!

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"today(0), today(1), and today(2) all mean something different...in this case shouldn't they all return the same "date" from which to start the calculation?"


No. today(0) is the data of the last finished script, which would be yesterday in your case.


today(1) is the "current date" equivalent.  today(2) is useful to ensure that "today" does not change if your script execution spans midnight.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"today(0), today(1), and today(2) all mean something different...in this case shouldn't they all return the same "date" from which to start the calculation?"


No. today(0) is the data of the last finished script, which would be yesterday in your case.


today(1) is the "current date" equivalent.  today(2) is useful to ensure that "today" does not change if your script execution spans midnight.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com