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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Is-Jacko
New Member

Transforming rows from form to 2 columns with duplicated value

Hello

Im very new to Power Query so I'm sorry if this is silly.

 

I have a form that outputs data like this:

IsJacko_0-1693824622404.png

 

Is there an easy way for me to transform that data to look like this?

IsJacko_1-1693824713891.png

 

 

Thank you

1 ACCEPTED SOLUTION
mlsx4
Memorable Member
Memorable Member

Hi @Is-Jacko 

 

Yes, you only need to unpivot columns on the Power Query Editor. To do so, you select all the columns except "Outer number" and go to Transform > Unpivot

mlsx4_0-1693905507065.png

Then you will obtain:

 

mlsx4_1-1693905542098.png

 

So, you remove the column you don't need: 

mlsx4_2-1693905581977.png

And rename column Value:

mlsx4_3-1693905609644.png

 

 

Here you have the code:

let
    Origen = Excel.Workbook(File.Contents("C:\example.xlsx"), null, true),
    Hoja1_Sheet = Origen{[Item="Hoja3",Kind="Sheet"]}[Data],
    #"Encabezados promovidos" = Table.PromoteHeaders(Hoja1_Sheet, [PromoteAllScalars=true]),
    #"Otras columnas con anulación de dinamización" = Table.UnpivotOtherColumns(#"Encabezados promovidos", {"Outer num"}, "Atributo", "Valor"),
    #"Columnas quitadas" = Table.RemoveColumns(#"Otras columnas con anulación de dinamización",{"Atributo"}),
    #"Columnas con nombre cambiado" = Table.RenameColumns(#"Columnas quitadas",{{"Valor", "Sample"}})
in
    #"Columnas con nombre cambiado"

 

View solution in original post

2 REPLIES 2
mussaenda
Super User
Super User

Hi @Is-Jacko ,

 

Select the Outer Num, and Unpivot Columns > Unpivot Other Columns

mlsx4
Memorable Member
Memorable Member

Hi @Is-Jacko 

 

Yes, you only need to unpivot columns on the Power Query Editor. To do so, you select all the columns except "Outer number" and go to Transform > Unpivot

mlsx4_0-1693905507065.png

Then you will obtain:

 

mlsx4_1-1693905542098.png

 

So, you remove the column you don't need: 

mlsx4_2-1693905581977.png

And rename column Value:

mlsx4_3-1693905609644.png

 

 

Here you have the code:

let
    Origen = Excel.Workbook(File.Contents("C:\example.xlsx"), null, true),
    Hoja1_Sheet = Origen{[Item="Hoja3",Kind="Sheet"]}[Data],
    #"Encabezados promovidos" = Table.PromoteHeaders(Hoja1_Sheet, [PromoteAllScalars=true]),
    #"Otras columnas con anulación de dinamización" = Table.UnpivotOtherColumns(#"Encabezados promovidos", {"Outer num"}, "Atributo", "Valor"),
    #"Columnas quitadas" = Table.RemoveColumns(#"Otras columnas con anulación de dinamización",{"Atributo"}),
    #"Columnas con nombre cambiado" = Table.RenameColumns(#"Columnas quitadas",{{"Valor", "Sample"}})
in
    #"Columnas con nombre cambiado"

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.