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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtracting 2 fields

Hi ;

I have two field that l want to subtract. [Last Drop Arrival Date] minus [First Pick Departure Date].

   

First Pick Departure DateLast Drop Arrival DateTravelTime
18/01/2016 12:4718/01/2016 13:40
18/01/2016 18:5218/01/2016 19:52
19/01/2016 00:5019/01/2016 01:44
20/01/2016 03:2020/01/2016 04:38

I am not getting any results when l subtract the 2 fields.

Please assist.

3 Replies
sunny_talwar

May be you need to help QlikView Understand you TimeStamp Fields using TimeStamp#() function

LOAD *,

          [Last Drop Arrival Date] - [First Pick Departure Date] as TravelTime;

LOAD

TimeStamp#([First Pick Departure Date], 'DD/MM/YYYY hh:mm') as [First Pick Departure Date],

TimeStamp#([Last Drop Arrival Date], 'DD/MM/YYYY hh:mm') as [Last Drop Arrival Date]

FROM Source;

swuehl
MVP
MVP

SET TimestampFormat = 'DD/MM/YYYY hh:mm';

LOAD

    [First Pick Departure Date],

    [Last Drop Arrival Date],

    Interval(  [Last Drop Arrival Date]-[First Pick Departure Date]) as TravelTime,

,,

Colin-Albert
Partner - Champion
Partner - Champion

Use the INTERVAL() function to calculate the difference between two time or date values.