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.
Hello friends
What I want to establish is probably best explained by an example.
Let's say I have the following table:
Toy | Good/Bad |
Abacus | Good |
Abacus | Bad |
Abacus | Bad |
Abacus | Bad |
Puzzle | Good |
Puzzle | Bad |
Puzzle | Bad |
Doll | Good |
Doll | Good |
Doll | Good |
I do a matrix visual in PBI with toys as row labels and good/bas as columns:
Row Labels | Bad | Good | Grand Total |
Abacus | 3 | 1 | 4 |
Doll | 3 | 3 | |
Puzzle | 2 | 1 | 3 |
Grand Total | 5 | 5 | 10 |
I want to add another column (see below):
Row Labels | Bad | Good | Grand Total | Percentage of Good Toys |
Abacus | 3 | 1 | 4 | 25% |
Doll | 3 | 3 | 100% | |
Puzzle | 2 | 1 | 3 | 33% |
Grand Total | 5 | 5 | 10 | 50% |
What's the best way to achieve this?
Many thanks in advance.
Devesh
Solved! Go to Solution.
@DeveshSeth you don't' need to put good/bad on columns, just 4 measures that are created.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@DeveshSeth here is the measure
% Good = DIVIDE ( CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Good/Bad] = "Good" ), COUNTROWS ( 'Table' ) )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k Thanks, I think we're close but how do I use the measure in the matrix visual to obtain the table (with % good column) I provided in my question. When I add it to the matrix visual I get the attached table - with extra columns that are not wanted.
The table columns should look like this:
Row Labels | Bad | Good | Grand Total | Percentage of Good Toys |
Abacus | 3 | 1 | 4 | 25% |
Doll | 3 | 3 | 100% | |
Puzzle | 2 | 1 | 3 | 33% |
Grand Total | 5 | 5 | 10 | 100% |
Hi,
This is not a method i'd prefer to use but i had to. You may download my PBI file from here.
Hope this helps.
Hi Ashish
Thanks, but your solution is starting with a pivot of the original table and hence it is possible to visualize via a 'Table' visual.
How do I start with the table posted in my original question and still achieve the intended solution?
Thanks
Devesh
Sorry I see the pivot step in M query now.
Hi,
If my reply helped, please mark it as Answer.
Thanks again Ashish. For many reasons, I wanted the solution to use the matrix visualization with the columns mentioned. Specially because the table has a lot of other columns/processed data and is used for multiple other reports/dashboards - hence it won't be possible to pivot in M unless am doing that for only this visualization separately.
The data I used in a simple stylized example to explain the problem.
Hi,
Here's another bad method, yet a method. You may download my PBI file from here.
Hope this helps.
You are welcome. In which case, i dno't think you will get a perfect solution to this problem.
@DeveshSeth do you have only two categories good and bad, if yes then you can add following measures, and without doing any transformation, you can use table/matrix visual
Total = COUNTROWS( Table )
Good = CALCULATE( [Total], Table[Good/Bad] = "Good" )
Bad = CALCULATE( [Total], Table[Good/Bad] = "Bad" )
use the above measures in your visual
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation! ⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
But the question still remains - how do I get the percentage column in my matrix visual?
@DeveshSeth you can use the same % calculation which I provided before, nothing changed on that. You should be able to take it from here.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation! ⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Unfortunately, putting % good column in matrix visual gives me this:
I have put Toys as row label and Good/bad as columns, value field has 'Count of Good Bad' and '%Good". Could you tell me what are you putting in your matrix visual to give you the result as outlined in my original question?
@DeveshSeth you don't' need to put good/bad on columns, just 4 measures that are created.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Bingo. Magic!
Many thanks for the solution and also for bearing with my naivety.
As you probably said, this wouldn't be a preferred solution. In my case, the table itself has multiple columns and many other processing step and Ideally I wouldn't want to pivot the whole data in M query. The pivoting step is preferred last (as a matrix visual) after data transformation, adding business logic (including in M and DAX) is done.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |