|
楼主 |
发表于 2022-5-22 14:55
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
let
源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
a = Table.AddColumn(源,"A",(x)=>Text.Split(Text.TrimEnd(x[所属月份],"月"),"-")),
b = Table.AddColumn(a,"B",(x)=>Number.From(x[A]{1})-Number.From(x[A]{0})+1),
c = Table.AddColumn(b,"C",(x)=>Number.RoundDown(x[金额]/x[B],2)),
d = Table.AddColumn(c,"D",(x)=>List.Repeat({x[C]},x[B])),
e = Table.AddColumn(d,"E",(x)=>x[金额]-List.Sum(x[D])),
f = Table.AddColumn(e,"F",(x)=>{x[D]{0}+x[E]} & List.Skip(x[D]) ),
#"展开的“F”" = Table.ExpandListColumn(f, "F"),
删除的列 = Table.RemoveColumns(#"展开的“F”",{"所属月份", "A", "B", "C", "D", "E"}),
排序的行 = Table.Sort(删除的列,{{"F", Order.Ascending}})
in
排序的行 |
|