有什么办法可以做到这一点吗?
代码如下:
let
StDt = [start],
AllDates =
{Number.From([start])..Number.From([end])},
StoMonthDates =
List.Distinct(
List.Select(
List.InsertRange(
List.Transform(
AllDates,
each Date.StartOfDay(Date.From(_))
),
0,
{[start]}
),
each Number.From(_) >= Number.From(StDt)
)
)
in StoMonthDates
答案1
使用创建从到的List.Dates
不同日期的包容性列表的示例start
end
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each
List.Dates(Date.From([start]),
Duration.Days(Date.From([end]) - Date.From([start]))+1,
#duration(1,0,0,0)))
答案2
我使用该List.RemoveFirstN
函数删除列表中每个元素的第一行。
= Table.AddColumn(#"Changed Type", "Custom", each let
StDt = [start],
AllDates =
{Number.From([start])..Number.From([end])},
StoMonthDates =
List.RemoveFirstN(
List.Distinct(
List.Select(
List.InsertRange(
List.Transform(
AllDates,
each Date.StartOfDay(Date.From(_))
),
0,
{[start]}
),
each Number.From(_) >= Number.From(StDt)
)
),
1)
in StoMonthDates)