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
JonathanJohns
Helper III
Helper III

Table Transformation

Good afternoon,

 

I've got a table like this one :

 

LOTInd 1Ind 2Ind 3
110  
1 50 
1  30
2 20 
220  
2  20
3 10 
3  10
310  

 

And I would like to tansform the table like this one :

 

LOTInd 1Ind 2Ind 3
1105030
2202020
3101010

 

Do you have any idea how to make that please ? My example is only with 3 lines and 3 columns but in reality I have 400 columns and 10 000 lines.

 

Thank you for your help.

1 ACCEPTED SOLUTION
Interkoubess
Solution Sage
Solution Sage

Hi @JonathanJohns,

 

You can use these codes below in Power Query. To sum up please unpivot your data first and pivot it.

 

Code 1 : I used the url you gave:

let
    Source = Web.Page(Web.Contents("http://community.powerbi.com/t5/Desktop/Table-Transformation/m-p/404994#M185333")),
    Data0 = Source{0}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Data0, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"LOT", Int64.Type}, {"Ind 1", Int64.Type}, {"Ind 2", Int64.Type}, {"Ind 3", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"LOT"}, "Attribute", "Value"),
    #"Pivoted Column" = Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Attribute]), "Attribute", "Value")
in
    #"Pivoted Column"

 

Code 2: In your data, you can accomplish these steps

 

 #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"LOT"}, "Attribute", "Value"),
    #"Pivoted Column" = Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Attribute]), "Attribute", "Value")

 

Let us know if you did not succeed in doing it...

 

Hope it helps.

 

Ninter

View solution in original post

2 REPLIES 2
Interkoubess
Solution Sage
Solution Sage

Hi @JonathanJohns,

 

You can use these codes below in Power Query. To sum up please unpivot your data first and pivot it.

 

Code 1 : I used the url you gave:

let
    Source = Web.Page(Web.Contents("http://community.powerbi.com/t5/Desktop/Table-Transformation/m-p/404994#M185333")),
    Data0 = Source{0}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Data0, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"LOT", Int64.Type}, {"Ind 1", Int64.Type}, {"Ind 2", Int64.Type}, {"Ind 3", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"LOT"}, "Attribute", "Value"),
    #"Pivoted Column" = Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Attribute]), "Attribute", "Value")
in
    #"Pivoted Column"

 

Code 2: In your data, you can accomplish these steps

 

 #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"LOT"}, "Attribute", "Value"),
    #"Pivoted Column" = Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Attribute]), "Attribute", "Value")

 

Let us know if you did not succeed in doing it...

 

Hope it helps.

 

Ninter

It works.

 

Thank you !

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.