Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi I need help with creating new rows
I need help with creating rows so everything that is in Type 2, Type 3 and Type 4 are in the new row and everything will be listed under Type 1 (final to look like below). Is it possible? Tia.
State | Product | Type 1 |
Victoria | Product A | Apple |
Victoria | Product A | Apple |
Victoria | Product A | Apple |
Victoria | Product A | Apple |
Victoria | Product A | Apple |
Victoria | Product A | Apple |
Victoria | Product A | Orange |
Victoria | Product A | Orange |
Victoria | Product A | Orange |
Victoria | Product A | Orange |
Victoria | Product A | Orange |
Victoria | Product A | Orange |
Victoria | Product B | Guava |
Victoria | Product B | Guava |
Victoria | Product B | Guava |
Victoria | Product B | Guava |
Victoria | Product B | Guava |
Victoria | Product B | Guava |
Victoria | Product B | Guava |
Victoria | Product B | Guava |
Victoria | Product B | Banana |
Victoria | Product B | Banana |
Victoria | Product B | Banana |
Victoria | Product B | Banana |
Victoria | Product B | Banana |
Victoria | Product B | Banana |
Victoria | Product B | Banana |
Victoria | Product B | Banana |
Victoria | Product B | Guava |
Victoria | Product C | Guava |
Victoria | Product C | Guava |
Victoria | Product C | Guava |
Victoria | Product C | Guava |
Victoria | Product C | Guava |
Victoria | Product B | Banana |
Victoria | Product C | Banana |
Victoria | Product C | Banana |
Victoria | Product C | Banana |
Victoria | Product C | Banana |
Victoria | Product C | Banana |
Victoria | Product B | Pineapple |
Victoria | Product C | Pineapple |
Victoria | Product C | Pineapple |
Victoria | Product C | Pineapple |
Victoria | Product C | Pineapple |
Victoria | Product C | Pineapple |
Solved! Go to Solution.
Hi @Marshmallow
You can put the following code to advanced editor in power query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCstMVtJRCijKTylNLlFwBLIdCwpyUoG0f1FiXjqIAUKxOiNEqROQ7V6aWJYIUeGUmAeEo0pppjQgMy81ERw1mHqcR56eWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [State = _t, Product = _t, Type1 = _t, Type2 = _t, Type3 = _t, Type4 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"State", type text}, {"Product", type text}, {"Type1", type text}, {"Type2", type text}, {"Type3", type text}, {"Type4", type text}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"State", "Product"}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns", each ([Value] <> "")),
#"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"Product", Order.Ascending}, {"Value", Order.Ascending}})
in
#"Sorted Rows"
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
=Table.CombineColumns(YourTable,List.Skip(Table.ColumnNames(YourTable),2),Text.Combine,"Type1")
Select both State and Product Columns --> Right Click --> Unpivot Other Columns
Hi @Marshmallow
You can put the following code to advanced editor in power query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCstMVtJRCijKTylNLlFwBLIdCwpyUoG0f1FiXjqIAUKxOiNEqROQ7V6aWJYIUeGUmAeEo0pppjQgMy81ERw1mHqcR56eWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [State = _t, Product = _t, Type1 = _t, Type2 = _t, Type3 = _t, Type4 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"State", type text}, {"Product", type text}, {"Type1", type text}, {"Type2", type text}, {"Type3", type text}, {"Type4", type text}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"State", "Product"}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns", each ([Value] <> "")),
#"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"Product", Order.Ascending}, {"Value", Order.Ascending}})
in
#"Sorted Rows"
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
8 | |
8 | |
7 |
User | Count |
---|---|
17 | |
13 | |
7 | |
6 | |
6 |