- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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]
Afsar Shaikh
Project Manager- QlikView Dev. & Support
Afsar Shaikh
Email- afsar.shaikh@live.com
- Tags:
- qlikview_scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Kushal_Chawda I'll check and confirm you on the same.
Afsar Shaikh
Project Manager- QlikView Dev. & Support
Afsar Shaikh
Email- afsar.shaikh@live.com