用到了ACC,试试:
- let
- 进货 = Excel.CurrentWorkbook(){[Name="进货"]}[Content],
- 出货 = Table.TransformColumns(Excel.CurrentWorkbook(){[Name="出货"]}[Content],{"列1",each Text.From(Date.MonthName(_,"en-us"))}),
- 已添加索引 = Table.AddIndexColumn(进货, "索引", 1, 1, Int64.Type),
- 累加 = Table.AddColumn(已添加索引, "累加", each List.Sum(List.FirstN(已添加索引[Quantity Received],[索引])),type number),
- 分配 = Table.AddColumn(累加, "自定义", each Record.FromList(List.Accumulate(出货[每个月的使用量],{{},[累加]},(x,y)=>if y>x{1} then {x{0}&{x{1}},0} else {x{0}&{y},x{1}-y} ){0},出货[列1])),
- 展开 = Table.ExpandRecordColumn(分配, "自定义", 出货[列1])
- in
- 展开
复制代码
|