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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
AndreaSo
Frequent Visitor

pie chart and distinct count

Hi, I went through several similar solutions but I still did not get to understand how to solve the problem.

 

From data below, I have 5 different products (a1,a2,a3,a4,a5) and some of them are categorised with 8D 8115, this represents that the product has a fault. 

 

I would like to show on a pie grapth how many products we have in total (in this case 5), how many products have defect (in this case a1,a3 and a2) and not affected 2 (a4, a5).

 

This is the data example:

AndreaSo_0-1687156100761.png

 

I tried to use distinct coult of Serial number and add Category into the legend, but this is the result.

AndreaSo_1-1687156100756.png

 

 

 

 

Thank you in advance for help. 

1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

could you create 2 measures to calculate to totals e.g:

 

Issue = VAR __Table = ADDCOLUMNS('Table',"Categort",[Category])
RETURN
  COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,NOT([Category]="")),"Serial number",[Serial number])))
 
No Issue = CALCULATE(DISTINCTCOUNT('Table'[Serial number]))-[Issue]
 
DOLEARY85_0-1687162901736.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

4 REPLIES 4
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

could you create 2 measures to calculate to totals e.g:

 

Issue = VAR __Table = ADDCOLUMNS('Table',"Categort",[Category])
RETURN
  COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,NOT([Category]="")),"Serial number",[Serial number])))
 
No Issue = CALCULATE(DISTINCTCOUNT('Table'[Serial number]))-[Issue]
 
DOLEARY85_0-1687162901736.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

You helped me! It works, thank you a lot. 🙂 

PhilipTreacy
Super User
Super User

Hi @AndreaSo 

 

So you want to show the values 5, 3 and 2?  Why the need to show the total also, why not just add 3 + 2?  maybe I  misunderstand?

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


You are correct, the value 5 does not need to be shown explicitly, it just need to be the total of the whole circle.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.