Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kevjay74
Frequent Visitor

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

1 ACCEPTED SOLUTION

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. 

View solution in original post

5 REPLIES 5
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

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. 

Greg_Deckler
Super User
Super User

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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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?.

ashishrj
Power Participant
Power Participant

@kevjay74 Try using Matrix visualization available in Power BI Desktop Tool and see if this works Smiley Happy

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.