Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Duration between two Time fields not dates

Dear team,

I have a table where I have arrival time in one column and left time in another field, i need to know the duration between those two times

I am using qlik sense

the outcome should be in hours but decimal example 2.5 is two hrs and 30 min

thank you in advance.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

at least i got a result but it was worng, what i am missing here is what i was using:

=Interval(Timestamp#([Left Time],'hh:mm')-Timestamp#([Arrival Time],'hh:mm'),'hh:mm')

View solution in original post

18 Replies
benoitgochel
Contributor III
Contributor III

Hi,

You can try a Timestamp([Left Time] - [Arrival Time]) and use the format you want.

You can also chose to display as a duration in the measure parameters

Hope that helps.

Best regards

Anonymous
Not applicable
Author

Thank you for your prompt reply, but it didn't work.

it is just time filed, could be not recognized as such in qlik?

example currently have them as 18:40 in an excel column

benoitgochel
Contributor III
Contributor III

What if you try something like this :

round(([Left Time]-[Arrival Time])*1440,0.02)

YoussefBelloum
Champion
Champion

Hi,

you will need to use Interval() function

Take a look here to understand how it works: https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/FormattingFunc...

example:

Interval(left_time-arrival_time,'hh:mm')

Anonymous
Not applicable
Author

no also not working.

Anonymous
Not applicable
Author

Thank you

but didn't work i'm using this:

=Interval([Left Time]-[Arrival Time],'hh:mm')

YoussefBelloum
Champion
Champion

then you will need to evaluate your timestamp fields correctly using Timestamp#()

like this

=Interval(Timestamp#(left_time,'your format')-Timestamp#(arrival_time,'your_format'),'hh:mm')

PS: if the format of your time field is this: DD/MM/YYYY hh:mm:ss then just replace it in the greyed part above

Anonymous
Not applicable
Author

at least i got a result but it was worng, what i am missing here is what i was using:

=Interval(Timestamp#([Left Time],'hh:mm')-Timestamp#([Arrival Time],'hh:mm'),'hh:mm')

Anonymous
Not applicable
Author

hey i did it

this one works: so i was missing the timestamp

=(Timestamp#([Left Time],'hh:mm')-Timestamp#([Arrival Time],'hh:mm'))*1440