Forum Discussion

vishwanathans's avatar
vishwanathans
Icon for Helper II rankHelper II
5 years ago
Solved

Unpivot multiple headers in a data

Hello,   I am trying to figure out if there is way to unpivot multiple header data.   Tried few steps in M query but i couldn't get it to achieve the results.   Here is my data.     MTD ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi vishwanathans 

    Try transpose and merge in power query to achieve your goal.

    Firstly we need to duplicate your original table and transform them as below.

    Sample Table(Table1):

    Duplicate Sample to Table2 and Remove all column except Column1,2,3. And only keep last 4 rows in this table.

    Remove Column1 and Column2 in Table1.

    Transpose all columns in Table1.

    Then select column6,7,8,9 and use unpivote function. 

    Finally, merge Table1 and Table2 by number column and expand table to get result.

    Merge:

    Result:

    Best Regards,

    Rico Zhou

     

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