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! Request now

Reply
JPY
Helper II
Helper II

How do I transpose selected columns into rows

Hi all,

This is what I have at the moment:

 

Transpose.PNG

 

This is what I want:

name des
aH12345
aH45678
bH44444
cH55555
cH66666
cH77777
dH88888

 

How would I go about doing this in the Power BI?

Appreciate any of your suggestions!

 

Best,

JPY 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

@JPY 

Here's how I would do it - unpivot all columns except name then tidy up (important steps in red):

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUfIwNDI2MQUxTEzNzC2ADKVYnWilJLAICIBEoILJIEFTEAAxzEAAxDAHAbCCFBDXAgRgumIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [name = _t, des = _t, #"1" = _t, #"2" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}, {"des", type text}, {"1", type text}, {"2", type text}}),
    UnpivotAllExceptName = Table.UnpivotOtherColumns(#"Changed Type", {"name"}, "Attribute", "Value"),
    RenameToDes = Table.RenameColumns(UnpivotAllExceptName,{{"Value", "des"}}),
    RemoveAttribute = Table.RemoveColumns(RenameToDes,{"Attribute"}),
    RemoveBlankDes = Table.SelectRows(RemoveAttribute, each ([des] <> "" and [des] <> null))
in
    RemoveBlankDes

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

@JPY 

Here's how I would do it - unpivot all columns except name then tidy up (important steps in red):

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUfIwNDI2MQUxTEzNzC2ADKVYnWilJLAICIBEoILJIEFTEAAxzEAAxDAHAbCCFBDXAgRgumIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [name = _t, des = _t, #"1" = _t, #"2" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}, {"des", type text}, {"1", type text}, {"2", type text}}),
    UnpivotAllExceptName = Table.UnpivotOtherColumns(#"Changed Type", {"name"}, "Attribute", "Value"),
    RenameToDes = Table.RenameColumns(UnpivotAllExceptName,{{"Value", "des"}}),
    RemoveAttribute = Table.RemoveColumns(RenameToDes,{"Attribute"}),
    RemoveBlankDes = Table.SelectRows(RemoveAttribute, each ([des] <> "" and [des] <> null))
in
    RemoveBlankDes

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Hi @OwenAuger,

 

Thanks for the prompt reply!

It works for me. 

Appreciate for your help

 

Best,

Joyce 

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
Top Kudoed Authors