Forum Discussion
DonPepe
Helper II
4 years agoConvert List in Function
Hi, My goal is to get all the working date for a service from a given Start date and a given End date knowing that I know only the day of week and the service validity. Parameters : Start ...
- 4 years ago
Use this
Table.AddColumn( Source, "DateList", each List.Select( List.Dates( Date.FromText(StartDate), Duration.Days(Date.FromText(EndDate) - Date.FromText(StartDate)) + 1, #duration(1, 0, 0, 0) ), (x)=> Date.DayOfWeek(x) = Number.From([DAY_IN_WEEK]) ) )
DonPepe
Helper II
4 years agoYeah sorry, PLAOSP Start Day In Week is the name of the field, I simplified it by "DAY_IN_WEEK" in this example.
Vijay_A_Verma
Most Valuable Professional
4 years agoUse this
Table.AddColumn(
Source,
"DateList",
each List.Select(
List.Dates(
Date.FromText(StartDate),
Duration.Days(Date.FromText(EndDate) - Date.FromText(StartDate)) + 1,
#duration(1, 0, 0, 0)
),
(x)=> Date.DayOfWeek(x) = Number.From([DAY_IN_WEEK])
)
)- DonPepe4 years ago
Helper II
Woah, so nice, thanks a lot.
I am not familiar with expression like this
(x)=> Date.DayOfWeek(x)
I will try to study more on that 🙂
Have an excellent day !