我有以下数据集:
test
我想将6003.1和6003.2部分加在一起,所以我只有6003,我的数据集看起来像这样:
lookup criterion s[m] Ns[MN] My[MNm] Mz[MNm] Vy[MN] Vz[MN] Mt[MNm] part
1000max NSga1EPSel1sl1se1pa6002 max NS 131 -29.8787 2.4734 4.7149 0.2146 0.9537 0.0439 6002
1000min MYga1EPSel1sl1se1pa6002 min MY 131 -42.2365 -38.9471 7.0569 0.0571 -4.3567 0.2086 6002
1000max NSga1EPSel1sl1se1pa6003 max NS 182 -4.5598 -3.5734 0.6512 -0.1213 0 -0.1213 6003.1
1000min MYga1EPSel1sl1se1pa6003 min MY 182 -11.4483 -10.314 4.3061 -0.2013 0 -0.2013 6003.1
1000max NSga1EPSel1sl1se1pa6003 max NS 0 -5.0888 4.0277 2.4967 0.1602 0 -0.1602 6003.2
1000min MYga1EPSel1sl1se1pa6003 min MY 0 -5.0888 4.0277 2.4967 0.1602 0 -0.1602 6003.2
1000max NSga1EPSel1sl1se1pa6004 max NS 36 -11.4002 0 -0.7057 -0.02 0 0 6004
1000min MYga1EPSel1sl1se1pa6004 min MY 36 -15.2575 0 -0.4365 -0.0289 0 0 6004
我认为这与索引行并旋转我的列然后事后取消生存有关,但最终我得到了一堆像这样的空行:
lookup criterion s[m] Ns[MN] My[MNm] Mz[MNm] Vy[MN] Vz[MN] Mt[MNm] part
1000max NSga1EPSel1sl1se1pa6002 max NS 131 -29.8787 2.4734 4.7149 0.2146 0.9537 0.0439 6002
1000min MYga1EPSel1sl1se1pa6002 min MY 131 -42.2365 -38.9471 7.0569 0.0571 -4.3567 0.2086 6002
1000max NSga1EPSel1sl1se1pa6003 max NS 182 -9.6486 0.4543 3.1479 0.0389 0 -0.2815 6003
1000min MYga1EPSel1sl1se1pa6003 min MY 182 -16.5371 -6.2863 6.8028 -0.0411 0 -0.3615 6003
1000max NSga1EPSel1sl1se1pa6004 max NS 36 -11.4002 0 -0.7057 -0.02 0 0 6004
1000min MYga1EPSel1sl1se1pa6004 min MY 36 -15.2575 0 -0.4365 -0.0289 0 0 6004
因此,如果这实际上是正确的方法,那么如何将所有这些空行移到同一行上?
这是我到目前为止的代码:
lookup criterion s[m] Index Attribute 6002 6003.1 6003.2 6004
1000max NSga1EPSel1sl1se1pa6002 max NS 131 1 Mt[MNm] 0.0439 null null null
1000max NSga1EPSel1sl1se1pa6002 max NS 131 1 My[MNm] 2.4734 null null null
1000max NSga1EPSel1sl1se1pa6002 max NS 131 1 Mz[MNm] 4.7149 null null null
1000max NSga1EPSel1sl1se1pa6002 max NS 131 1 Ns[MN] -29.8787 null null null
1000max NSga1EPSel1sl1se1pa6002 max NS 131 1 Vy[MN] 0.2146 null null null
1000max NSga1EPSel1sl1se1pa6002 max NS 131 1 Vz[MN] 0.9537 null null null
1000max NSga1EPSel1sl1se1pa6003 max NS 0 5 Mt[MNm] null null -0.1602 null
1000max NSga1EPSel1sl1se1pa6003 max NS 0 5 My[MNm] null null 4.0277 null
1000max NSga1EPSel1sl1se1pa6003 max NS 0 5 Mz[MNm] null null 2.4967 null
1000max NSga1EPSel1sl1se1pa6003 max NS 0 5 Ns[MN] null null -5.0888 null
1000max NSga1EPSel1sl1se1pa6003 max NS 0 5 Vy[MN] null null 0.1602 null
1000max NSga1EPSel1sl1se1pa6003 max NS 0 5 Vz[MN] null null 0 null
1000max NSga1EPSel1sl1se1pa6003 max NS 182 3 Mt[MNm] null -0.1213 null null
1000max NSga1EPSel1sl1se1pa6003 max NS 182 3 My[MNm] null -3.5734 null null
1000max NSga1EPSel1sl1se1pa6003 max NS 182 3 Mz[MNm] null 0.6512 null null
1000max NSga1EPSel1sl1se1pa6003 max NS 182 3 Ns[MN] null -4.5598 null null
1000max NSga1EPSel1sl1se1pa6003 max NS 182 3 Vy[MN] null -0.1213 null null
1000max NSga1EPSel1sl1se1pa6003 max NS 182 3 Vz[MN] null 0 null null
1000max NSga1EPSel1sl1se1pa6004 max NS 36 7 Mt[MNm] null null null 0
1000max NSga1EPSel1sl1se1pa6004 max NS 36 7 My[MNm] null null null 0
1000max NSga1EPSel1sl1se1pa6004 max NS 36 7 Mz[MNm] null null null -0.7057
1000max NSga1EPSel1sl1se1pa6004 max NS 36 7 Ns[MN] null null null -11.4002
1000max NSga1EPSel1sl1se1pa6004 max NS 36 7 Vy[MN] null null null -0.02
1000max NSga1EPSel1sl1se1pa6004 max NS 36 7 Vz[MN] null null null 0
1000min MYga1EPSel1sl1se1pa6002 min MY 131 2 Mt[MNm] 0.2086 null null null
1000min MYga1EPSel1sl1se1pa6002 min MY 131 2 My[MNm] -38.9471 null null null
1000min MYga1EPSel1sl1se1pa6002 min MY 131 2 Mz[MNm] 7.0569 null null null
1000min MYga1EPSel1sl1se1pa6002 min MY 131 2 Ns[MN] -42.2365 null null null
1000min MYga1EPSel1sl1se1pa6002 min MY 131 2 Vy[MN] 0.0571 null null null
1000min MYga1EPSel1sl1se1pa6002 min MY 131 2 Vz[MN] -4.3567 null null null
1000min MYga1EPSel1sl1se1pa6003 min MY 0 6 Mt[MNm] null null -0.1602 null
1000min MYga1EPSel1sl1se1pa6003 min MY 0 6 My[MNm] null null 4.0277 null
1000min MYga1EPSel1sl1se1pa6003 min MY 0 6 Mz[MNm] null null 2.4967 null
1000min MYga1EPSel1sl1se1pa6003 min MY 0 6 Ns[MN] null null -5.0888 null
1000min MYga1EPSel1sl1se1pa6003 min MY 0 6 Vy[MN] null null 0.1602 null
1000min MYga1EPSel1sl1se1pa6003 min MY 0 6 Vz[MN] null null 0 null
1000min MYga1EPSel1sl1se1pa6003 min MY 182 4 Mt[MNm] null -0.2013 null null
1000min MYga1EPSel1sl1se1pa6003 min MY 182 4 My[MNm] null -10.314 null null
1000min MYga1EPSel1sl1se1pa6003 min MY 182 4 Mz[MNm] null 4.3061 null null
1000min MYga1EPSel1sl1se1pa6003 min MY 182 4 Ns[MN] null -11.4483 null null
1000min MYga1EPSel1sl1se1pa6003 min MY 182 4 Vy[MN] null -0.2013 null null
1000min MYga1EPSel1sl1se1pa6003 min MY 182 4 Vz[MN] null 0 null null
1000min MYga1EPSel1sl1se1pa6004 min MY 36 8 Mt[MNm] null null null 0
1000min MYga1EPSel1sl1se1pa6004 min MY 36 8 My[MNm] null null null 0
1000min MYga1EPSel1sl1se1pa6004 min MY 36 8 Mz[MNm] null null null -0.4365
1000min MYga1EPSel1sl1se1pa6004 min MY 36 8 Ns[MN] null null null -15.2575
1000min MYga1EPSel1sl1se1pa6004 min MY 36 8 Vy[MN] null null null -0.0289
1000min MYga1EPSel1sl1se1pa6004 min MY 36 8 Vz[MN] null null null 0
非常感谢您
答案 0 :(得分:1)
首先,确定主要零件编号-从您的样本数据中,这看起来就像我们只是将零件编号四舍五入为整数值一样。
然后,您可以按lookup
,criterion
和part
进行分组,然后对值列求和:
let
Source = Append1,
#"Identify Part" = Table.TransformColumns(Source,{{"part", Number.RoundDown, Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Identify Part", {"lookup", "criterion", "part"}, {{"s[m]", each List.Sum([#"s[m]"]), type number}, {"Ns[MN]", each List.Sum([#"Ns[MN]"]), type number}, {"My[MNm]", each List.Sum([#"My[MNm]"]), type number}, {"Mz[MNm]", each List.Sum([#"Mz[MNm]"]), type number}, {"Vy[MN]", each List.Sum([#"Vy[MN]"]), type number}, {"Vz[MN]", each List.Sum([#"Vz[MN]"]), type number}, {"Mt[MNm]", each List.Sum([#"Mt[MNm]"]), type number}}),
#"Reordered Columns" = Table.ReorderColumns(#"Grouped Rows",{"lookup", "criterion", "s[m]", "Ns[MN]", "My[MNm]", "Mz[MNm]", "Vy[MN]", "Vz[MN]", "Mt[MNm]", "part"})
in
#"Reordered Columns"
示例PBIX文件:https://pwrbi.com/so_55019712/