Forum Discussion
Krankyboy
1 year agoNew Member
Looping through a table to find a vaue
Hi I want to pass into a function a date and number, (the number of workdays a task will take) from my fact table. I have a second table which is just rows of workdays and a second column with...
Anonymous
1 year agoNot applicable
Hi Krankyboy ,
Please try new a custom function:
let
GetEndDate = (startDate as date, workDays as number) =>
let
filteredWorkDays = Table.SelectRows(Table, each [date] >= startDate),
workDayList = List.Distinct(Table.Column(filteredWorkDays, "date")),
requiredWorkDays = List.FirstN(workDayList, workDays),
endDate = List.Last(requiredWorkDays)
in
endDate
in
GetEndDate
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum