4行列转换(Power Query)

问题如下图:

let
    源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
    逆透视的其他列 = Table.UnpivotOtherColumns(源, {"标题1"}, "属性", "值"),
    分组的行 = Table.Group(逆透视的其他列, {"标题1"}, {"内容", each Table.PromoteHeaders(Table.Skip(Table.Transpose(_),1))}),
    展开 = Table.ExpandTableColumn(分组的行, "内容", {"标题2", "标题3", "标题4", "标题5", "标题2_1", "标题3_2", "标题4_3", "标题5_4", "标题2_5", "标题3_6", "标题4_7", "标题5_8", "标题2_9", "标题3_10", "标题4_11", "标题5_12"}),
    更改的类型 = Table.TransformColumnTypes(展开,{{"标题1", type text}, {"标题2", Int64.Type}, {"标题3", Int64.Type}, {"标题4", Int64.Type}, {"标题5", Int64.Type}, {"标题2_1", Int64.Type}, {"标题3_2", Int64.Type}, {"标题4_3", Int64.Type}, {"标题5_4", Int64.Type}, {"标题2_5", Int64.Type}, {"标题3_6", Int64.Type}, {"标题4_7", Int64.Type}, {"标题5_8", Int64.Type}, {"标题2_9", Int64.Type}, {"标题3_10", Int64.Type}, {"标题4_11", Int64.Type}, {"标题5_12", Int64.Type}})
in
    更改的类型

 

posted @ 2022-10-22 18:45  熬肥妖  阅读(166)  评论(0编辑  收藏  举报