Forum Discussion

ApurvaKhatri's avatar
ApurvaKhatri
Helper III
8 years ago

Column to rows for measures

Hi, I have a measure value New-Pay, Old-Pay and Difference.

 

I have picked the values in the table as follows.

 

FirstName LastName  New-Pay  Old-Pay   Difference   

John          Bolt           2000         1500         500

 

 

However, my manager wants it to be displayed as:

 

FirstName John

LastName Bolt

New-Pay 2000

 Old-Pay  1500

Difference  500

 

Which visualization should I use? How is is possible??

 

Thanks.

6 Replies

  • Omega's avatar
    Omega
    Impactful Individual

    You can try to unpivot the table in the query editor and then create an indexing column.

     

    Create a copy of your table

     

    Once you create your table, click on "Edit Queries" in the home ribbon. -> Select your table -> Select all the columns in table

    -> Click on transform ribbon -> then click on "unpivot columns"

     

    Click on "Add Column" and the click on "Index Column", this is for clustering and sorting your rows. Otherwise, the sorting will be alphabetically. 

     

    Power BI will create three columns: Attribute, Value and Index (You can change the name). 

     

    Apply the the changes -> Create table -> Drag all three columns and then hide Index and by decreasing the width of the column. 

     

    Hope this helps. 

     

     

     

    • ApurvaKhatri's avatar
      ApurvaKhatri
      Helper III

      These are possible for existing columns in a tabel. But are they possible for measures created on a table?

      • Omega's avatar
        Omega
        Impactful Individual

        Can you please ellaborate?