Hi there,
Has any one got the solution for "Due date calculation deducting weekend and public holiday".
I got the pieces from this site.
But the issues is, output is wrong.
Example: Mr. XYZ return date is 3rd of Nov 2021 and there is public holiday on 4th and 5th. 6th and 7th is (Sat/Sun- Holiday) Weekend.
If i need to calculate due date (After 10 business day) then output should be 19th of Nov 2021.
but the my output is 11/17/2021 (17th Nov 2021) - Need expert advice.
With({ Rdate:DateValue(DC_ReturnDate.SelectedDate),
daysToAdd: 10
},
DateAdd(Rdate, daysToAdd) +
RoundDown(daysToAdd/5, 0)*2 +
Switch(Weekday(Rdate, StartOfWeek.Monday),
5,If(Mod(daysToAdd, 5)>0,2,0),
4,If(Mod(daysToAdd, 5)>1,2,0),
3,If(Mod(daysToAdd, 5)>2,2,0),
2,If(Mod(daysToAdd, 5)>3,2,0),
1,If(Mod(daysToAdd, 5)>4,2,0)
) +
CountIf(Publicholiday, DateValue(Date) >= Rdate, DateValue(Date) <= DateAdd(Rdate, daysToAdd))
)
Note: Publicholiday is collection where I have list of public holiday.
Date is the Holiday Date Field.