Qlik Community

Qlik Sense App Development

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

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
asaadsaleh
New 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
New Contributor III

Re: Duration between two Time fields not dates

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')

18 Replies
benoitgochel
New Contributor III

Re: Duration between two Time fields not dates

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

Re: Duration between two Time fields not dates

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

Re: Duration between two Time fields not dates

What if you try something like this :

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

YoussefBelloum
Esteemed Contributor

Re: Duration between two Time fields not dates

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

Re: Duration between two Time fields not dates

no also not working.

Highlighted
asaadsaleh
New Contributor III

Re: Duration between two Time fields not dates

Thank you

but didn't work i'm using this:

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

YoussefBelloum
Esteemed Contributor

Re: Duration between two Time fields not dates

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

Re: Duration between two Time fields not dates

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

Re: Duration between two Time fields not dates

hey i did it

this one works: so i was missing the timestamp

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