Forum Discussion

yetanotherusern's avatar
yetanotherusern
New Member
3 years ago
Solved

Transpose? Pivot? Unpivot?

With PowerQuery how can I get from this

HeaderID
Comment from X1
Group 12
Posted Aug 8, 20223
ID123224
  
  
Comment from John1
Group 22
Posted Sep 6, 20223
ID1234
  
  
Comment from John1
Group 22
Posted Sep 12, 20223
ID123234

 To

1234
Comment from XGroup 1Posted Aug 8, 2022ID12322
Comment from JohnGroup 2Posted Sep 6, 2022ID123
Comment from JohnGroup 2Posted Sep 12, 2022ID12323

 

Thank you so much

  • Hey yetanotherusern 

    you can use the Pivot Operation, but first you have to prepare the table:

    1. remove the empty rows
    2. add an index column
    3. create a grouping column (a custom column), this one is necessary, otherwise Pivot will not work

    This is how the table will look after these steps:

    This is the formula for the custom column.

    Number.RoundUp( [Index] / 4 )

    Then i removed the Index column, marked the ID column and use the transform Pivot configured like this:


    And here is the result:


    Hopefully, this provides what you are looking for.

     

    Regards,
    Tom

2 Replies

  • Hey yetanotherusern 

    you can use the Pivot Operation, but first you have to prepare the table:

    1. remove the empty rows
    2. add an index column
    3. create a grouping column (a custom column), this one is necessary, otherwise Pivot will not work

    This is how the table will look after these steps:

    This is the formula for the custom column.

    Number.RoundUp( [Index] / 4 )

    Then i removed the Index column, marked the ID column and use the transform Pivot configured like this:


    And here is the result:


    Hopefully, this provides what you are looking for.

     

    Regards,
    Tom

    • yetanotherusern's avatar
      yetanotherusern
      New Member

      Herzlichen Danke - wirklich toll! 

      (Heartfelt thank you - really cool)