Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Exclusion of Saturday and Sunday

Hi All,

I have a requirement, to calculate the business working hours between two Dates that exclude Saturday and Sunday .

Consider the below example,

Start Date/Time Stamp , (Date Received) Friday Night 9.00 PM (17.03.2017 9.00 PM),

End Date/Time stamp ,(Process Date)  Monday Morning 10.00 AM (20.03.2017 10.00 AM)

Now I want to calculate the time difference between 9.00 PM to 10.00 AM(not considering the Saturday and Sunday (48 hours)).

The result would be 13.00 Hours.

Thanks in Advance!

Regards,

Sharanya

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Will it be work ?

= Interval(

rangesum(

NetWorkDays([Date Received+1,[Process Date]-1) * 1 // 24 hours per workday, for all day inbetween the period, excluding bounderies

,if(NetWorkDays([Process Date],[Process Date]), frac([Process Date]),0) // working hours last day

,if(NetWorkDays([Date Received,[Date Received),1-frac([Date Received),0) // working hours first day

,if(NetWorkDays([Date Received,[Date Received) and floor([Date Received)=floor([Process Date]),-1 ) // correct for first equals last day

), 'hh:mm:ss ')

View solution in original post

5 Replies
avinashelite

use this function

networkingdays()

avinashelite

networkdays (start:date, end_date {, holiday})

Returns the number of working days (Monday-Friday) between and including start_date and end_date taking into account any optionally listed holidays. All parameters should be valid dates or timestamps.

Examples:

networkdays ('2007-02-19', '2007-03-01') returns 9 

networkdays ('2006-12-18', '2006-12-31', '2006-12-25', '2006-12-26') returns 8 

adamdavi3s
Master
Master

Take a peek here, assuming you can do this in the script of course

Calculate hours between two Date/Time strings

Anonymous
Not applicable
Author

Hi Avinash,

Thanks for your reply

Calculation difference should be in time stamp (HH:MM:SS)

Anonymous
Not applicable
Author

Will it be work ?

= Interval(

rangesum(

NetWorkDays([Date Received+1,[Process Date]-1) * 1 // 24 hours per workday, for all day inbetween the period, excluding bounderies

,if(NetWorkDays([Process Date],[Process Date]), frac([Process Date]),0) // working hours last day

,if(NetWorkDays([Date Received,[Date Received),1-frac([Date Received),0) // working hours first day

,if(NetWorkDays([Date Received,[Date Received) and floor([Date Received)=floor([Process Date]),-1 ) // correct for first equals last day

), 'hh:mm:ss ')