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...
slorin
Super User
1 year agoHi Krankyboy
Workdays_Table[Workday_Column]{List.PositionOf(Workdays_Table[Workday_Column], [date]) + [number] }
Stéphane
- Krankyboy1 year agoNew Member
Hi,
Thanks for the response. But this is not the answer. I should have added more info.
my workday table is just rows like the following;
date isWorkDay (always 1)
2025-01-02 1
2025-01-03 1
2025-01-06 1
2024-01-07 1
I want to pass in a task start date, say 2025-01-01 which takes 3 days, I assume I would have to loop 3 times then return 2025-01-06. That returned date will become the start date for the next task. My fact table will have about 12 task starts per row along with 12 workdays.
- wdx223_Daniel1 year ago
Community Champion
=Table.ExpandListColumn(Table.AddColumn(YourFactTable,"Workday Date",each List.FirstN(Table.Skip(WorkdayTable,(x)=>x[Date]<[Date])[Date],[Number])),"Workday Date")