AnsweredAssumed Answered

Calculate a future date minus weekends and holidays

Question asked by ndelacretaz on Apr 24, 2013
Latest reply on May 18, 2013 by debi

I've tried a couple of CFs for this and am not getting correct results.

 

Found one called NextWorkDay(tempDate;listOfHolidays) that seemed like what I needed. It is defined as:

 

Let ( [

isWorkDay = Mod ( tempDate - 1 ; 7 ) < 5 and IsEmpty ( FilterValues ( tempDate ; listOfHolidays ) )

] ;

Case (

isWorkDay ; tempDate ;

NextWorkDay ( tempDate + 1 ; listOfHolidays )

)

)

 

I basically need to loop through a group of "schedule task" records and get a date by adding a prescribed number of days to a preceding task's date (stored in a related record). Here's the calc I use in my looping script that employs the CF above:

 

Let([

p=PrecedingTask::ProjectedDate;

d=Task::DaysToAdd;

HolidayList=Task::_cListHolidays

];

NextWorkDay(p+d ; HolidayList )

)

 

I'm attaching a screenshot that shows the strange results (example: asking to get the NextWorkDay for PrecedingTask + 11 days only yields the PrecedingTask date + 6 work days)

 

Any experience/ideas/other approaches that might work? Thanks...

Outcomes