Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Please help me on the below script. I've used networkdays function to include only working days and used a variable for the holidays. However, now I want to include the non working days as well in my calculation.
Could anyone please help me to modify my script to get over this?
if(Act_Status=5,if( Act_VerklPlaneratDatum < Act_FärdigDatum, -(networkdays(Act_VerklPlaneratDatum + 1,Act_FärdigDatum,$(Helgdagar))), (networkdays(Act_FärdigDatum + 1,Act_VerklPlaneratDatum,$(Helgdagar)))), if( Act_VerklPlaneratDatum < Today(), -(networkdays(Act_VerklPlaneratDatum + 1,Today(),$(Helgdagar))), (networkdays(Today() + 1,Act_VerklPlaneratDatum,$(Helgdagar))))) as [No of days]
If you want the total number of days between two dates, just subtract one date from the other - no need for complex functions or calculations.
If you want to include non working days as well then networkdays function won't be useful. You can simply take a subtraction between two dates which will give you days difference and then you can use networkdays functions to exclude the holidays if you want. So overall logic will go like below
rangesum((EndDate-StartDate+1),
-(networkdays(StartDate,EndDate)-networkdays(StartDate,EndDate,$(vHolidays)))
networkdays(StartDate,EndDate)-networkdays(StartDate,EndDate,$(vHolidays))
Above highlighted logic will give you no. of holidays between two dates. Note that this will not work if you have holidays falls on non working days as this function will already exclude them. If so then need to handle the calculation of holidays bit differently which I have covered in my below blog post
Working-days-and-hours-calculations-for-custom-weekends
Thanks @Kushal_Chawda I'll check and confirm you on the same.