Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I was wondering if someone would be able to help me with this query. I am new to Qlikview and have created a straight chart where all my information goes into. I have created a new column which I called Time (log-close).
In that new column I want to be able to calculate in hours, the difference between a field called closedate(which is a date/time field 01/01/2010 09:00:00) and a field called logdate (which is also a date time field 01/01/2010 09:00:00).
To calculate the difference I used the following expression: Interval (closedate - logdate), which gave me the correct hours:minutes:seconds.
However our business hours are only between 08:00 - 18:00. Therefore if we had the example 1 below, at the moment the hours would show as 49:00:00. However as we are not interested in time before 08:00 and after 18:00, the correct time should show as 20:00:00.
To make matters more complicated we are also not interested in weekends, therefore in example 2, the way we currently have it the hours would show as 66:00:00 (as the dates are over the weekend), however the correct time should show as 04:00:00 (as this will ignore times after 18:00 and also the whole of Saturday and Sunday).
Is there a way this can be done?
Example 1:
Logdate - 01/08/2012 09:00:00
Closedate - 03/8/2012 10:00:00
Example 2:
Logdate - 03/08/2012 15:00:00
Closedate - 06/08/2012 09:00:00
Hi
I want to calculate hours between two dates like below
1- Calculate hours between two dates only for week dates in between 7 AM to 11 PM
2- Calculate hours only for Saterday and Sunday in between 10 AM to 4 PM
for example - if satrt time = 25-8-2019 8:10
End Time = 27-8-2019
then Total time = 6 hours for 25-08 as its Sunday + 18.12 hours for Monday(26-08) and Tuesday(27-08)
how can i achieve that
Hi
Can you please elaborate your code ? actualy I just wanted to know why you subtract 1 in closed date ?
Amazing job Swuehl!! With some amendments it worked properly for me.