Forum Discussion

aktripathi2506's avatar
10 years ago
Solved

Replacing columns with rows

Hi,

 

In my table suppose I have 5 column A, B, C, D and E. I have values for them.

 

Example:

 

ABCDE
52215324
1048259
119644
21481211
25112104
3248715
25159228
48746
12669

8

 

Now when I display the average of these column it comes like this:

 

Avg of AAvg of BAvg of CAvg of DAvg of E
1697147

 

 

But I want to display it like below:

 

Avg of A16
Avg of B9
Avg of C7
Avg of D14
Avg of E7

 

Please advise.

 

Thanks a lot.

  • v-sihou-msft's avatar
    v-sihou-msft
    10 years ago

    aktripathi2506

     

    In Power BI Desktop, you can directly use your large input table and return the average of each item without exporting the data at all. Please refer to steps below:

    1. Add an Index column(from 1).
    2. Right click on Index column, select "Unpivot other columns".
    3. Click on "Attribute" column, select "Group By".
    4. Set "Group by" like below. You will get expect result.

    Regards,

7 Replies

  • arify's avatar
    arify
    Microsoft Employee

    Hi,

     

    Once you have the 2nd table:

     

    Avg of AAvg of BAvg of CAvg of DAvg of E
    1697147

     

    You can select all columns (click first column, then shift+click last column), right click, pick "Unpivot Columns". That will produce exactly what you want :)

     

    • aktripathi2506's avatar
      aktripathi2506
      Helper IV

      Hi,

       

      I have a big input table, which has several columns including columns A, B, C,D and E.

       

      2nd table I am getting is as a result. Do you know any way to use this table as an input other than exporting the data and uploading it again to power bi and then doing unpivot the columns.

       

      Because I want less mannual efforts.

       

      Thanks.

      • arify's avatar
        arify
        Microsoft Employee

        Sorry, I don't have much knowledge about the Service, we'll need someone else's help on that.

         

        Thanks