RattlingCarp3048
Board Regular
- Joined
- Jan 12, 2022
- Messages
- 202
- Office Version
- 365
- Platform
- Windows
I have created a new custom column with a simple (startdate - enddate)*24 then change the data type to decimal and round in order to calculate to hours like i need. in the custom column i tried the networkdays formula but that didnt work. i also found a custom function for creating your own networkdays function but that just gives me an error for all rows (pasted below). how do i exclude weekends and holidays??
**with 5/27/24 as a holiday** (startdate - enddate)*24
custom networkdays
(StartDate as date, EndDate as date, HolidayList as list) =>
let
DateList=List.Dates(StartDate,Number.From(EndDate-StartDate)+1,#duration(1,0,0,0)),
RemoveWeekends=List.Select(DateList, each Date.DayOfWeek(_,Day.Monday)<5),
RemoveHolidays=List.RemoveItems(RemoveWeekends, HolidayList),
CountDays=List.Count(RemoveHolidays)
in
CountDays
**with 5/27/24 as a holiday** (startdate - enddate)*24
custom networkdays
(StartDate as date, EndDate as date, HolidayList as list) =>
let
DateList=List.Dates(StartDate,Number.From(EndDate-StartDate)+1,#duration(1,0,0,0)),
RemoveWeekends=List.Select(DateList, each Date.DayOfWeek(_,Day.Monday)<5),
RemoveHolidays=List.RemoveItems(RemoveWeekends, HolidayList),
CountDays=List.Count(RemoveHolidays)
in
CountDays