Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
afsarshaikh
Creator
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.

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]

Regards,
Afsar Shaikh
Project Manager- QlikView Dev. & Support
Afsar Shaikh
Email- afsar.shaikh@live.com
3 Replies
Or
MVP
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.

 

Kushal_Chawda

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

 

afsarshaikh
Creator
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