Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Transpose and Unpivot

I have a table that looks like the following:

 

Date---------Project----Role----Resource----Value

1/1/2020----1----------1--------R1-----------0

1/2/2020----1----------1--------R1-----------1

1/1/2020----1----------1--------R2-----------2

1/2/2020----1----------1--------R2-----------3

 

I need it to look like this:

 

Date---------Project----Role----R1----R2

1/1/2020----1----------1--------0-----2

1/2/2020----1----------1--------1-----3

 

Can anyone help me, please?

  • You should consider keeping your data unpivoted, but here is how you do this.  In the query editor, highlight/select the Resource column and choose Pivot Column on the transform tab.  Choose the Value column for values and choose "Don't Aggregate".

     

    Regards,

    Pat

     

3 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    You should consider keeping your data unpivoted, but here is how you do this.  In the query editor, highlight/select the Resource column and choose Pivot Column on the transform tab.  Choose the Value column for values and choose "Don't Aggregate".

     

    Regards,

    Pat

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      mahoneypat , thank you. I am still very new to this. 

      • AllisonKennedy's avatar
        AllisonKennedy
        Community Champion
        Anonymous Another option is to use a Matrix visualization, put Date, Project, Role in Rows, put Resource in Columns and Value in Value. Then adjust the formatting options for the matrix (for example drill all the way down and turn stepped layout off).
        This follows mahoneypat 's suggestion to keep your data unpivoted.