Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Work minutes

Hi, I want to find the the WORK-MINUTES between 2 dates(DT1 and DT2) excluding weekends(other holidays not required). I have work hours from 1 AM to 10 PM(22:00)(we have teams across multiple geographies, hence extended work hours).

There are many posts however I was not able to achieve what I want.

The best I have come across is the below but I dont know what modification is needed for my requirement:

Interval(

rangesum(

NetWorkDays(DT1+1,DT2-1,$(vHol)) * MakeTime(10) 

// 10 hours per workday, for all day inbetween the period, excluding bounderies

,if(NetWorkDays(DT2,DT2,$(vHol)),Rangemin(rangemax(frac(DT2),maketime(8)),maketime(18))-Rangemax(rangemin(frac(DT2),maketime(8)),maketime(8)),0)

// working hours last day

,if(NetWorkDays(DT1,DT1,$(vHol)),Rangemin(rangemax(frac(DT1),maketime(18)),maketime(18))-Rangemax(rangemin(frac(DT1),maketime(18)),maketime(8)),0) // working hours first day

,if(NetWorkDays(DT1,DT1,$(vHol)) and floor(DT1)=floor(DT2),-MakeTime(10))

// correct for first equals last day

)

)

Please advise.

Thanks!!!!

Sam

12 Replies
Not applicable
Author

Hi,

PFA app, which excludes weekends and only considers the working time (1:00 am - 10:00 pm) in mins.

Hope this helps.

Regards,

Amay

Anonymous
Not applicable
Author

Thanks all for your help!

Sorry I couldnt respond earlier. I tested the code and it worked perfectly!

Thanks again!!!

Anonymous
Not applicable
Author

One follow up question:

I have multiple dates:

DT1, DT2

DT3, DT4

DT5,DT6

I want to find the work minutes between these dates. So can we create a subroutine and pass on the 2 dates and the ID field, and this should return the work minutes between those 2 dates for that ID?

Thanks

SP