Forum Discussion
Rows to Column
- 7 years ago
Mahadevaraobc You need to transform your data a bit (in this case your main table) as below in Power Query Editor.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ndDLCsJADAXQf5l1B3LTPCZbBYWiLgRxUfr/v+EULFLpA13nTO7c9H1SYiIpEMtKSE26XzmrBWciOt7S0EwmqprMo2TWbXPQC8sIWl0GXekM2arA6gbxbB4ky+CEzmgEbCv/rF3Aaj93QYSBZzfxAH0ZqYuKbGUhijuZvo0WrY0dvDF2ppXx5x7YA/5X/hnPNsb3S4D3AnjeYHgB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Unique ID" = _t, ProductNo = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Unique ID", type text}, {"ProductNo", type text}}), #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Unique ID"}, "Attribute", "Value"), #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value", "Product"}}), #"Grouped Rows" = Table.Group(#"Renamed Columns", {"Unique ID"}, {{"AllRows", each _, type table}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([AllRows],"Product")), #"Renamed Columns1" = Table.RenameColumns(#"Added Custom",{{"Custom", "Product"}}), #"Extracted Values" = Table.TransformColumns(#"Renamed Columns1", {"Product", each Text.Combine(List.Transform(_, Text.From), ","), type text}), #"Removed Columns1" = Table.RemoveColumns(#"Extracted Values",{"AllRows"}), #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns1", "Product", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Product.1", "Product.2", "Product.3", "Product.4", "Product.5", "Product.6", "Product.7"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Product.1", type text}, {"Product.2", type text}, {"Product.3", type text}, {"Product.4", type text}, {"Product.5", type text}, {"Product.6", type text}, {"Product.7", type text}}) in #"Changed Type1"This will bring you the output as below
Then you need to filter this by using your Lookup UniqueIDs list. This can be done either in Power Query Editor or DAX. As we are alredy in Power Query Editor, I've done this step in Query Editor itself as below using Merge Queries option.
let Source = Table.NestedJoin(Test251Main,{"Unique ID"},Test251Lkp,{"Unique ID"},"Test251Lkp",JoinKind.Inner), #"Removed Columns" = Table.RemoveColumns(Source,{"Test251Lkp"}) in #"Removed Columns"
Hi Mahadevaraobc,
You could achieve this in bringing Matrix visual to pivot all the rows into columns.
Regards,
Pradeep
- Mahadevaraobc7 years agoHelper II
This will only show unique i would like to get all, alse it should display product no and not just count...
- PattemManohar7 years agoCommunity Champion
Mahadevaraobc You need to transform your data a bit (in this case your main table) as below in Power Query Editor.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ndDLCsJADAXQf5l1B3LTPCZbBYWiLgRxUfr/v+EULFLpA13nTO7c9H1SYiIpEMtKSE26XzmrBWciOt7S0EwmqprMo2TWbXPQC8sIWl0GXekM2arA6gbxbB4ky+CEzmgEbCv/rF3Aaj93QYSBZzfxAH0ZqYuKbGUhijuZvo0WrY0dvDF2ppXx5x7YA/5X/hnPNsb3S4D3AnjeYHgB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Unique ID" = _t, ProductNo = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Unique ID", type text}, {"ProductNo", type text}}), #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Unique ID"}, "Attribute", "Value"), #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value", "Product"}}), #"Grouped Rows" = Table.Group(#"Renamed Columns", {"Unique ID"}, {{"AllRows", each _, type table}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([AllRows],"Product")), #"Renamed Columns1" = Table.RenameColumns(#"Added Custom",{{"Custom", "Product"}}), #"Extracted Values" = Table.TransformColumns(#"Renamed Columns1", {"Product", each Text.Combine(List.Transform(_, Text.From), ","), type text}), #"Removed Columns1" = Table.RemoveColumns(#"Extracted Values",{"AllRows"}), #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns1", "Product", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Product.1", "Product.2", "Product.3", "Product.4", "Product.5", "Product.6", "Product.7"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Product.1", type text}, {"Product.2", type text}, {"Product.3", type text}, {"Product.4", type text}, {"Product.5", type text}, {"Product.6", type text}, {"Product.7", type text}}) in #"Changed Type1"This will bring you the output as below
Then you need to filter this by using your Lookup UniqueIDs list. This can be done either in Power Query Editor or DAX. As we are alredy in Power Query Editor, I've done this step in Query Editor itself as below using Merge Queries option.
let Source = Table.NestedJoin(Test251Main,{"Unique ID"},Test251Lkp,{"Unique ID"},"Test251Lkp",JoinKind.Inner), #"Removed Columns" = Table.RemoveColumns(Source,{"Test251Lkp"}) in #"Removed Columns" - Anonymous7 years agoNot applicable
Have you tried Show blank values in your axis and value columns?
Regards,
Pradeep
- Mahadevaraobc7 years agoHelper II
Where can i get this?