Forum Discussion

andrewb95's avatar
andrewb95
Helper II
4 years ago
Solved

Pivoting Data in a Matrix

I want to be able to pivot how data looks in a matrix. I have the following table currently existing: 

 

ItemABAB
Hour991010
Day    
Monxyzxyzxyzxyz
Tuexyzxyzxyzxyz
Wedxyzxyzxyzxyz

 

I want to be able to pivot the table so that my values are showing as following: 

 

Hour9101112
Mon A     
Mon B    
Tue A    

Tue B

    

 

Essentially the table will show the day of the week twice so that I can easily compare. 

 

The values/fields I have are:
1. Day of the Week 

2. Hour

3. Value A 

4. Value B

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  andrewb95 ,

    I created some data:

    Here are the steps you can follow:

    1. Enter the power query, select ValueA and ValueB two columns, click Transform-Unpivot Columns

    Result:

    2. Create calculated column.

    Day_of_the_week = 'Table'[Day of the week] &""& 'Table'[Value]

    3. Result:

     

    Best Regards,

    Liu Yang

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

3 Replies

  • bcdobbs's avatar
    bcdobbs
    Community Champion

    Not sure if it 100% meets you requirement but in the Values section of the matrix Format pane there is a setting called "Show On Rows". Try enabling it.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  andrewb95 ,

    I created some data:

    Here are the steps you can follow:

    1. Enter the power query, select ValueA and ValueB two columns, click Transform-Unpivot Columns

    Result:

    2. Create calculated column.

    Day_of_the_week = 'Table'[Day of the week] &""& 'Table'[Value]

    3. Result:

     

    Best Regards,

    Liu Yang

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

  • The Matrix approach in the accepted answer is correct for the static layout. Worth adding for anyone landing here: once this Matrix is published, the pivot structure is locked end-users in Power BI Service can't swap rows and columns or restructure the layout themselves without going back to Desktop.

    If your requirement is for end-users to drag fields and restructure the pivot after publishing like they would in Excel Flexa Tables on AppSource handles this. The layout stays flexible in the published report