Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Good, I just recommend using Interval() for this specific need, because it is designed exactly for this type of calculations..
don't forget to close the thread
didn't work for intervals, can you using what i shared, convert it by using intervals so i can check it.
yes, but you will need to share a sample app for that I should take YOUR expression with YOUR data to convert it
Thank you here is the sample data,
i have faced an issue, that the left time sometimes is in the next day after 12:00am so the time is negative.
in the sample there is the date as well, so can you create something that will calculate the duration using the date and time,
really appreciate it.
here you are
it is working as expected
it is an empty file, couldn't load it, can you paste the code here that you have used?
try it again
there is no code, only this expression:
=Interval(Timestamp#([Left Time],'hh:mm')-Timestamp#([Arrival Time],'hh:mm'),'hh:mm')
put your dimensions and use the expression above
it is giving decimal and not working multiplying by 1440
and you didn't react towards the day. as subtracting two times might give negative if in different days.
regards.
I wrote something related to the day and I delete it, if you want to include the day, you can do it by concatenating your Day field with your time field inside the Timestamp#() function, like this:
=Interval(Timestamp#([Left Date]&[Left Time],'DD-MM-YYYY hh:mm')-Timestamp#([Arrival Date]&[Arrival Time],'DD-MM-YYYY hh:mm'),'hh:mm')
if this don't solve your problem, take the solution that is working for you
Regards