Forum Discussion
LarsEva
2 years agoNew Member
Custom Function: Networkdays load rows very slowly
Hi, i'm new to using power query and i've been trying to calculate the networkdays of 2 columns in my table. I am using a custom function i found on the web (which i think everyone is using) That us...
- 2 years ago
Use following formula in a custom column to calculate Networkdays. You will need to replace Start and End
List.Count(List.Select(List.Dates([Start], Duration.Days([End]-[Start])+1, #duration(1,0,0,0)), each Date.DayOfWeek(_,1)<5))If you want a very fast way, then insert this step. Replace #"Changed Type" with your previous step and of course, Start and End.
= Table.FromRecords(List.Transform(Table.ToRecords(#"Changed Type"), (x)=> Record.AddField(x, "Networkdays", List.Count(List.Select(List.Dates(x[Start], Duration.Days(x[End]-x[Start])+1, #duration(1,0,0,0)), each Date.DayOfWeek(_,1)<5)))))
Vijay_A_Verma
2 years agoMost Valuable Professional
Use following formula in a custom column to calculate Networkdays. You will need to replace Start and End
List.Count(List.Select(List.Dates([Start], Duration.Days([End]-[Start])+1, #duration(1,0,0,0)), each Date.DayOfWeek(_,1)<5))
If you want a very fast way, then insert this step. Replace #"Changed Type" with your previous step and of course, Start and End.
= Table.FromRecords(List.Transform(Table.ToRecords(#"Changed Type"), (x)=> Record.AddField(x, "Networkdays", List.Count(List.Select(List.Dates(x[Start], Duration.Days(x[End]-x[Start])+1, #duration(1,0,0,0)), each Date.DayOfWeek(_,1)<5)))))
- LarsEva2 years agoNew Member
This worked out really well. Thank you for the help!