Forum Discussion

kevjay74's avatar
kevjay74
Frequent Visitor
10 years ago
Solved

Show measure in rows

 

Dear Forum

 

Hi I'm new to Power BI desktop, and like the product, but have come across an issue when displaying information, Hopefully it's due to my lack of knowledge, but I can't seem to find a way to display measures or values in rows instead of columns similar to Pivot tables functionality. Values in Row labels,

 

For example so if I had the following table

 

Product  Sales   Profit

a             10         5

b             20         10

c             30          5 

c             40         15

 

What I'd like to produce is something like .....

 

 a      b      c      Grand Total
Sales    102070100
Profit 5102035

 

Any advise on how to visualise this would be greatly appreciated.

 

Thanks

  • Hi Djorran, 

     

    Thank you, I followed the steps and happy to say these solution worked as long as I create the calculations I require in Power Query/Data load first. It would be nice to see the ablity to pivot including calculated measures but hopefully this will come in future releases, until then I should be able to work with this. Thank you all for your help. 

5 Replies

  • ashishrj's avatar
    ashishrj
    Icon for Power Participant rankPower Participant

    kevjay74 Try using Matrix visualization available in Power BI Desktop Tool and see if this works :smileyhappy:

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Making some assumptions about your data and assuming you want it pretty much exactly as you have it shown:

     

    Given data:

    Product  Sales   Profit

    a             10         5

    b             20         10

    c             30          5 

    c             40         15

     

    1. Create query to data "query1", edit query prior to load

    2. Remove Profit column

    3. Pivot column Product using Sales as value

    4. Add Custom Column "Type" with value "Sales" (Sales is in double quotes)

    5. Save query1

    6. Create query to data "query2", edit query prior to load

    7. Remove Sales column

    8. Pivot column Product using Profit as value

    9. Add Custom Column "Type" with value "Profit" (Profit is in double quotes)

    10. Save query2

    11. Edit queries

    12. Pick query1

    13. Append query2

    14. Save query

     

    Now you can create a visualization exactly as you have shown except that the column header for the first column will say "Type". A matrix visualization with row totals should give you your grand total.

    • kevjay74's avatar
      kevjay74
      Frequent Visitor

      Thank smourpre. It was an example, but your solution does help me display many of the items I want to show in this fashion

      However, I was also hoping to pivot calculated measures too, I have tried using the Matrix visualisation, but I can't seem to get this to work in this way. Am I right in assuming his is currently not possible in Power BI?.

  • Djorran's avatar
    Djorran
    Regular Visitor

    Hi,

    You can use the unpivot-function in Power BI Desginer (or Power Query). In your example you can mark the product column and then choose Transform -> Unpivot columns -> Unpivot other columns. This will give you the data structured as I show below. I renamed the column with Sales and Profit in it to Measures. With this structure you can use the column Measures as rows or as columns.

     

    Unpivot.JPG

    • kevjay74's avatar
      kevjay74
      Frequent Visitor

      Hi Djorran, 

       

      Thank you, I followed the steps and happy to say these solution worked as long as I create the calculations I require in Power Query/Data load first. It would be nice to see the ablity to pivot including calculated measures but hopefully this will come in future releases, until then I should be able to work with this. Thank you all for your help.