AnsweredAssumed Answered

Calculate Work hours in the previous Month

Question asked by xxx202xxx on Sep 5, 2017
Latest reply on Sep 5, 2017 by fmpdude

Hi again,  I used this calc to find the work hours for the given month (not interested in holidays) strictly M-Fr.  My question is what will I need to change in order to calculate work hours for the previous month? Would I put a -1 behind "Date (Month(D) -1 for both Start and End dates?

 

Let([

D = TotalHours;

startDate = Date ( Month ( D ) ; 1 ; Year ( D ) ) ;

endDate = Date ( Month ( D ) + 1 ; 0 ; Year ( D ) )

];

5 * Int ( ( EndDate - StartDate ) / 7 ) +Middle ( "0012345501234544012343340123223401211234010012340" ; 1 + 7 * (DayOfWeek ( StartDate ) - 1 ) + DayOfWeek ( EndDate ) ; 1 )

)

Outcomes