Forum Discussion
Anonymous
4 years agoNot applicable
Exclude Holiday in existing Networkday code
Hi all I have a code where I exclude the weekends to get the networkdays. Can someone help me to additional exclude the holidays which I want to set up in an excel file? This is my existing c...
- 4 years ago
(StartDate as date, EndDate as date) as number => List.Count(List.Select(List.Dates(StartDate, Number.From(EndDate-StartDate) + 1, #duration(1, 0, 0, 0)), each Date.DayOfWeek(_, Day.Monday) < 5 or not List.Contains(Holidays, _)))
Anonymous
4 years agoNot applicable
I don't really know how I should put this in my existing code... Could you write it with my existing code
CNENFRNL
4 years agoCommunity Champion
(StartDate as date, EndDate as date) as number =>
List.Count(List.Select(List.Dates(StartDate, Number.From(EndDate-StartDate) + 1, #duration(1, 0, 0, 0)), each Date.DayOfWeek(_, Day.Monday) < 5 or not List.Contains(Holidays, _)))- Anonymous4 years agoNot applicable
Thanks a lot! Any idea why the data load takes such a long time? is running for 10min and still didn't load the data...And I only have 3 dates to test in the holiday file.
- Anonymous4 years agoNot applicable
- Anonymous4 years agoNot applicable
Hi Anonymous,
I'd like to suggest you add buffer functions to these processes to prevent memory leaks and duplicated memory resources spent on these calculations.
Table.Buffer - PowerQuery M | Microsoft Docs
List.Buffer - PowerQuery M | Microsoft Docs
Regards,
Xiaoxin Sheng