Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
asaadsaleh
Contributor III
Contributor III

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
asaadsaleh
Contributor III
Contributor III
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

asaadsaleh
Contributor III
Contributor III
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')

asaadsaleh
Contributor III
Contributor III
Author

no also not working.

asaadsaleh
Contributor III
Contributor III
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

asaadsaleh
Contributor III
Contributor III
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')

asaadsaleh
Contributor III
Contributor III
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