Forum Discussion

MD986546's avatar
MD986546
New Member
5 years ago
Solved

Transforming row data into a new column

Would appreciate help with this problem.

How do I transform this ..................  

Column1Column2Column3Column4Column5

 ABD
1    
2    
3    
4    

This.................

Column1Column2
1A
1B
1C
1D
2A
2B
2C
2D
3A
3B
3C
3D
4A
4B
4C
4D

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi MD986546 

    You can use Unpivot Other Columns in Query Editor .

    Original data:

    Select the ID column and click Unpivot Other Columns ,then you will get three columns like this :

    Delete the Attribute column ,and close & apply to desktop view .You will get a result like this :

     

    Best Regards

    Community Support Team _ Ailsa Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • ChrisMendoza's avatar
    ChrisMendoza
    Icon for Resident Rockstar rankResident Rockstar

    Do you mean like this?

    You can do in Power Query (basically select all the columns then unpivot):

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("JcixEQAgCATBXj42EWhAoQuH/tvQG5MN9hytqaENCTXV462xkFD211lIKP8bLCRUqPsC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value"),
        #"Sorted Rows" = Table.Sort(#"Unpivoted Columns",{{"Attribute", Order.Ascending}, {"Value", Order.Ascending}})
    in
        #"Sorted Rows"

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi MD986546 

    You can use Unpivot Other Columns in Query Editor .

    Original data:

    Select the ID column and click Unpivot Other Columns ,then you will get three columns like this :

    Delete the Attribute column ,and close & apply to desktop view .You will get a result like this :

     

    Best Regards

    Community Support Team _ Ailsa Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.