Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for
Did you mean:
Creator

## Include non working days as well in the calculation

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.

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]

Regards,
Afsar Shaikh
Project Manager- QlikView Dev. & Support
Afsar Shaikh
Email- afsar.shaikh@live.com
3 Replies
MVP

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

Creator
Author

Thanks @Kushal_Chawda I'll check and confirm you on the same.

Regards,
Afsar Shaikh
Project Manager- QlikView Dev. & Support
Afsar Shaikh
Email- afsar.shaikh@live.com
Community Browser