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: 
shakeeb_mohammed
Contributor III
Contributor III

Summing time

Hi,

Can someone help me with the below please?

I have three fields within my data - Vehicle - start time and end time.

the start and end time are in time stamp - e.g. 23:52:25.

What i want to do is sum how many hours a vehicle has been driven.

example data -

Vehicle Start TimeEnd Time
Vehicle 100:02:3823:25:25
Vehicle 201:04:0020:00:00
Vehicle 306:00:0012:00:05

I'm using QlikSense.

Thanks in advance !

2 Replies
YoussefBelloum
Champion
Champion

Hi,

you can use Interval() function

https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/FormattingFunc...

make sure to evaluate and format your timestamps correctly

it should be something like this:

Interval([End Time]-[Star Time],'hh')


or if your fields are not yet correctly evaluated and formatted on the script:


Interval(Timestamp#([End Time],'hh:mm:ss')-Timestamp#([Star Time],'hh:mm:ss'),'hh')

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try Interval function to get the time difference.

Like

Load * ,Interval (EndTime-StartTime) as DriveTime

From xyz;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!