如何按表结果对表列进行分类并将标题作为结果返回

问题描述 投票:0回答:1

enter image description here

我想创建一个使用另一个表的数据的表,其中结果成为列标题(静态)并返回表 1 中的标题。由于表 1 中会有重复的结果,因此它必须以某种方式显示与A 栏。如果我没有正确地问这个问题,我深表歉意。 这是看起来应该很简单但事实并非如此的事情之一。谢谢你

我尝试了多个 INDEX 和 MATCH 函数,但还没有完全正确

datatable pivot-table powerquery
1个回答
0
投票

将数据从表/范围中引入整个数据后,powerquery 中的一种方法是将其粘贴到主页中..高级编辑器中...

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source, "Index2", 0, 1, Int64.Type),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Added Index", {"Column1", "Index2"}, "Attribute", "Value"),
#"Grouped Rows" = Table.Group(#"Unpivoted Other Columns", {"Column1", "Value"}, {{"data", each Table.AddIndexColumn(_, "Index", 0, 1, Int64.Type), type table }}),
#"Expanded data" = Table.ExpandTableColumn(#"Grouped Rows", "data", {"Attribute", "Index","Index2"}, {"Attribute", "Index","Index2"}),
#"Sorted Rows" = Table.Sort(#"Expanded data",{{"Value", Order.Ascending}}),
#"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each ([Value] <> 0)),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Filtered Rows", {{"Value", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Filtered Rows", {{"Value", type text}}, "en-US")[Value]), "Value", "Attribute"),
#"Sorted Rows1" = Table.Sort(#"Pivoted Column",{{"Index2", Order.Ascending}}),
#"Removed Columns" = Table.RemoveColumns(#"Sorted Rows1",{"Index", "Index2"})
in #"Removed Columns"

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.