Forum Discussion
abukapsoun
8 years agoPost Patron
Unpivot Table
Hi, I have a bit of strange request not sure if it is possible but I am giving it a try. I have the following table, Is there a way I can duplicate the row, and put technology-...
MarcelBeug
8 years agoCommunity Champion
Apologies for the late reaction.
You made one mistake: you added a column with the Integer-Divide, you should have Integer-Divided the Index column on the "Transform Column" tab, thus transforming the Index column in the Integer-Divided column.
If you corect that, it should be OK.
MarcelBeug
8 years agoCommunity Champion
On second thought, it may not work as I think you have null values.
An alternative approach is to unpivot the other columns and split the Attribute column on "-".
Then you can pivot back on column "Attribute,1" and remove "Attribute,2" afterwards,
let
Source = Table1,
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name"}, "Attribute", "Value"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute.1", type text}, {"Attribute.2", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Attribute.1]), "Attribute.1", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Pivoted Column",{"Attribute.2"})
in
#"Removed Columns"