Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Marshmallow
Helper II
Helper II

create new rows from multiple columns

Hi I need help with creating new rows

Marshmallow_0-1702257995219.png

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. 

 

StateProductType 1
VictoriaProduct AApple
VictoriaProduct AApple
VictoriaProduct AApple
VictoriaProduct AApple
VictoriaProduct AApple
VictoriaProduct AApple
VictoriaProduct AOrange
VictoriaProduct AOrange
VictoriaProduct AOrange
VictoriaProduct AOrange
VictoriaProduct AOrange
VictoriaProduct AOrange
VictoriaProduct BGuava
VictoriaProduct BGuava
VictoriaProduct BGuava
VictoriaProduct BGuava
VictoriaProduct BGuava
VictoriaProduct BGuava
VictoriaProduct BGuava
VictoriaProduct BGuava
VictoriaProduct BBanana
VictoriaProduct BBanana
VictoriaProduct BBanana
VictoriaProduct BBanana
VictoriaProduct BBanana
VictoriaProduct BBanana
VictoriaProduct BBanana
VictoriaProduct BBanana
VictoriaProduct BGuava
VictoriaProduct CGuava
VictoriaProduct CGuava
VictoriaProduct CGuava
VictoriaProduct CGuava
VictoriaProduct CGuava
VictoriaProduct BBanana
VictoriaProduct CBanana
VictoriaProduct CBanana
VictoriaProduct CBanana
VictoriaProduct CBanana
VictoriaProduct CBanana
VictoriaProduct BPineapple
VictoriaProduct CPineapple
VictoriaProduct CPineapple
VictoriaProduct CPineapple
VictoriaProduct CPineapple
VictoriaProduct CPineapple

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

vxinruzhumsft_0-1702433298331.png

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.

 

View solution in original post

3 REPLIES 3
wdx223_Daniel
Community Champion
Community Champion

=Table.CombineColumns(YourTable,List.Skip(Table.ColumnNames(YourTable),2),Text.Combine,"Type1")

spinfuzer
Solution Sage
Solution Sage

Select both State and Product Columns --> Right Click --> Unpivot Other Columns

Anonymous
Not applicable

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

vxinruzhumsft_0-1702433298331.png

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.

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.