Forum Discussion

ANU2's avatar
ANU2
New Member
8 years ago
Solved

Convert columns into rows in an existing table

I am new in power bi. i have a question. my input like this:

 

 

and i want the output like this: could you please help to find the equation?

thanks in advance.

  • Hi ANU2,

     

    Please locateto Query Editor mode, there, you could convert columns to rows via "Pivot".

     

    First, duplicate [YEAR] and [AGE] columns.

     

    Add an index column.

     

    Select [Year-Copy] field, click the "Pivot Columns" button. Then, remove the [Index] column, you could get the desired output.

     

    Best regards,

    Yuliana Gu

1 Reply

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi ANU2,

     

    Please locateto Query Editor mode, there, you could convert columns to rows via "Pivot".

     

    First, duplicate [YEAR] and [AGE] columns.

     

    Add an index column.

     

    Select [Year-Copy] field, click the "Pivot Columns" button. Then, remove the [Index] column, you could get the desired output.

     

    Best regards,

    Yuliana Gu