我是这样做的。
- 使用公式 = {1..[Duration]} 添加自定义列
- 展开自定义列
- 将开始日期更改为数字类型
- 使用公式 = [开始日期] + [自定义] -1 添加自定义列
- 将开始日期改回日期类型列
- 删除不必要的列
- 重命名列
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"Start Date", type datetime}, {"Ad Requests", Int64.Type}, {"Spend", Int64.Type}, {"Duration", Int64.Type}, {"Daily Adrequests", Int64.Type}, {"Daily Spend", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {1..[Duration]}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Start Date", Int64.Type}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "Custom.1", each [Start Date] + [Custom] -1),
#"Changed Type2" = Table.TransformColumnTypes(#"Added Custom1",{{"Custom.1", type date}}),
#"Reordered Columns" = Table.ReorderColumns(#"Changed Type2",{"Index", "Custom.1", "Start Date", "Ad Requests", "Spend", "Duration", "Daily Adrequests", "Daily Spend", "Custom"}),
#"Removed Columns" = Table.RemoveColumns(#"Reordered Columns",{"Start Date", "Ad Requests", "Spend", "Duration"})
in
#"Removed Columns"
之前/之后