请帮忙纠错与去除冗余步骤。谢谢!
为什么我用以下步骤后,A7077565的结果会出错呢?具体步骤如下:
let
源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
转换 = Table.TransformColumns(源,{"应判责任部门", each Table.FromList(Text.Split(,"#(lf)"))}),
展开 = Table.ExpandTableColumn(转换, "应判责任部门", {"Column1"}, {"应判责任部门"}),
数字 = Table.AddColumn(展开, "金额", each try Text.Remove([理赔金额], {Text.Remove( [理赔金额], {"0".."9"})}) otherwise null),
中文 = Table.AddColumn(数字, "部门", each Text.Start([应判责任部门],2)),
更改 = Table.TransformColumnTypes(中文,{{"金额", type number}}),
删除 = Table.RemoveColumns(更改,{"理赔金额", "应判责任部门"}),
分组 = Table.Group(删除, {"运单号"}, {{"计数", each Table.RowCount(), type number}}),
自定义1 = Table.NestedJoin(删除,"运单号",分组,"运单号","A",JoinKind.LeftOuter),
"展开的“A”" = Table.ExpandTableColumn(自定义1, "A", {"计数"}, {"计数"}),
已添加条件列 = Table.AddColumn(#"展开的“A”", "最后金额", each if [计数] = 1 then [金额] else [金额]/2),
删除的列 = Table.RemoveColumns(已添加条件列,{"金额", "计数"}),
已透视列 = Table.Pivot(删除的列, List.Distinct(删除的列[部门]), "部门", "最后金额", List.Sum)
in
已透视列