Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Removing Time Stamp and Calculating Estimated Departure - QlikSense

Hello - I am fairly advanced in QlikView but I have just started using QlikSense, so I am struggling with some of the limitations.

First, I have a date field formatted as:

02/29/2016 10:00AM

I would like to remove the timestamp and just format as MM/DD/YYYY, but nothing I have tried seems to be working.

Also, I have a "Length of Stay" field, which determines the length of a clients trip. I would like to add "Length of Stay" to the date field mentioned above to get an Estimated Date of Departure.

i.e

Date field = 05/05/2016

Length of Stay = 5

Calculated Field, Estimated Date of Departure = 05/10/2016

Thanks in advance,

- dave

1 Solution

Accepted Solutions
sunny_talwar

How about this:

LOAD Date(DATE + [Length of Stay], 'MM/DD/YYYY') as DEPARTURE_DATE

LOAD

  "Start Date",

    Date(Date#(Left(Trim([Start Date]), 10), 'MM/DD/YYYY'), 'MM/DD/YYYY') as DATE

View solution in original post

10 Replies
sunny_talwar

How about these

Date(Floor(TimeStamp('02/29/2016 10:00AM', 'MM/DD/YYYY hh:mmTT'))) as Date

Date(Floor(TimeStamp('02/29/2016 10:00AM', 'MM/DD/YYYY hh:mmTT')) + [Length of Stay]) as DEPARTURE_DATE
Anonymous
Not applicable
Author

Sunny - Its not working ... I feel like I am not sure if I am using the right quotations or brackets in the calculation:

LOAD

  "Start Date",

    Date(Floor(TimeStamp('Start Date', 'MM/DD/YYYY hh:mmTT')))

sunny_talwar

You are using TimeStamp or TimeStamp#? If timestamp# is still not working, can you try this:

LOAD

  "Start Date",

    Date(Date#(Left(Trim([Start Date]), 10), 'MM/DD/YYYY')', MM/DD/YYYY') as DATE

Anonymous
Not applicable
Author

Neither of these worked either ... Im not getting a wrong answer, I am just getting nothing in those fields

sunny_talwar

Check my response above

Anonymous
Not applicable
Author

Error in expression: ')' expected

sunny_talwar

May bad, try this:


LOAD

  "Start Date",

    Date(Date#(Left(Trim([Start Date]), 10), 'MM/DD/YYYY'), 'MM/DD/YYYY') as DATE

Anonymous
Not applicable
Author

Nice Sunny. That fixed the timestamp issue ... Now how do I incorporate that into the Est Dept Date calc?

sunny_talwar

How about this:

LOAD Date(DATE + [Length of Stay], 'MM/DD/YYYY') as DEPARTURE_DATE

LOAD

  "Start Date",

    Date(Date#(Left(Trim([Start Date]), 10), 'MM/DD/YYYY'), 'MM/DD/YYYY') as DATE