Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date Calculation

Morning,

I need to create a weeks figure, based on the time that an item has been on offer for sale, or TOO (Time on Offer). For example, I have an item which launched on 01/07/2014 today's date is 16/01/2018 so the TOO would be 209 Weeks. The data being provided by the SQL table is DATETIME, so i'm also not sure if I need to cater for this.

Any help is appreciated.

Regards

David

1 Solution

Accepted Solutions
teempi
Partner - Creator II
Partner - Creator II

Hi David,

You should be able to write something like this in your load script:

(Today() - [YourDateField]) / 7 AS TOO

You can also either Ceil() or Floor() the result depending on what you want.

-Teemu

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Sorry, that should be 185 Weeks, not 209!

teempi
Partner - Creator II
Partner - Creator II

Hi David,

You should be able to write something like this in your load script:

(Today() - [YourDateField]) / 7 AS TOO

You can also either Ceil() or Floor() the result depending on what you want.

-Teemu