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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
akash412singh
New Member

Unpivot Column

How Can I Unpivot a table where I have One Column for Order ID SKU1, SKU2, and SKU3 for SKUS Ordered and QTY1,QTY2 and QT3 for Quantities ?

akash412singh_0-1673434262999.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @akash412singh ,

I created a sample pbix file(see the attachment), please check if that is what you want.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUjYxMTYxMlXSUQpJTQSSEGQEZcXqwFSYAbnuIfHO+blJ+XBlhhjKzEGiCs75aWmpqXiUWQC5xujKMFRZArmuQCVFZanFyal5JQohjk7BCuGpmekZJTh1GRtguBS/GYao2g2x+QDDEiNUDxDlSoRuY7I8ZoIWSRgKQLGYnF/unpGaamhgYIBboRnYpLyU1CLn/OT8vNIScLyhRVYsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Order Number" = _t, SKU.1 = _t, SKU.2 = _t, SKU.3 = _t, QTY.1 = _t, QTY.2 = _t, QTY.3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Order Number", type text}, {"SKU.1", type text}, {"SKU.2", type text}, {"SKU.3", type text}, {"QTY.1", Int64.Type}, {"QTY.2", Int64.Type}, {"QTY.3", type text}}),
    #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"SKU.1", "SKU.2", "SKU.3"}, "SKUs", "SKU Value"),
    #"Unpivoted Only Selected Columns1" = Table.Unpivot(#"Unpivoted Only Selected Columns", {"QTY.1", "QTY.2", "QTY.3"}, "QTY Type", "QTY")
in
    #"Unpivoted Only Selected Columns1"

yingyinr_0-1673504927820.png

In addition, you can refer the following links to get it.

Unpivot only selected columns

Unpivot Table in Power BI

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @akash412singh ,

I created a sample pbix file(see the attachment), please check if that is what you want.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUjYxMTYxMlXSUQpJTQSSEGQEZcXqwFSYAbnuIfHO+blJ+XBlhhjKzEGiCs75aWmpqXiUWQC5xujKMFRZArmuQCVFZanFyal5JQohjk7BCuGpmekZJTh1GRtguBS/GYao2g2x+QDDEiNUDxDlSoRuY7I8ZoIWSRgKQLGYnF/unpGaamhgYIBboRnYpLyU1CLn/OT8vNIScLyhRVYsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Order Number" = _t, SKU.1 = _t, SKU.2 = _t, SKU.3 = _t, QTY.1 = _t, QTY.2 = _t, QTY.3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Order Number", type text}, {"SKU.1", type text}, {"SKU.2", type text}, {"SKU.3", type text}, {"QTY.1", Int64.Type}, {"QTY.2", Int64.Type}, {"QTY.3", type text}}),
    #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"SKU.1", "SKU.2", "SKU.3"}, "SKUs", "SKU Value"),
    #"Unpivoted Only Selected Columns1" = Table.Unpivot(#"Unpivoted Only Selected Columns", {"QTY.1", "QTY.2", "QTY.3"}, "QTY Type", "QTY")
in
    #"Unpivoted Only Selected Columns1"

yingyinr_0-1673504927820.png

In addition, you can refer the following links to get it.

Unpivot only selected columns

Unpivot Table in Power BI

Best Regards

serpiva64
Solution Sage
Solution Sage

Hi,

in the attached file you'll find a solution (if you don't need it dynamic).

If this post isuseful to help you to solve your issue consider giving the post a thumbs up and accepting it as a solution !

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors