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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
KathyO
Frequent Visitor

Counting repairs undertaken to create a pie graph

Hi there

 

I have a table of data which looks like this:

KathyO_0-1729720878374.png

And I simply want to create a pie graph which shows the number of times we have undertaken each repair, e.g. Sharp edge removal = 10, Wheel repair = 11, Welding = 2, Greasing = 1

 

How do I do that?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,lbendlin ,thanks for your concern about this issue.

Your answer is excellent!
And I would like to share some additional solutions below.

Hello,@KathyO .I am glad to help you.
As lbendlin suggested, using inverse pivot is indeed a very good way to make the data more readable!
I'd like to suggest some additional suggestions below, which I hope will be helpful to you.

suggestion1.
Create measures directly.


vjtianmsft_0-1729819420220.png

 

 

Count_Creasing = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing"))



Count_Welding = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))


Count_Wheel repair = CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair"))

 

Put the measures to the pie graph.

suggestion2.
If your real data does match the screenshot you've shown, it's a good idea to create a table of calculations to visualize the results.

vjtianmsft_1-1729819546678.png

create calculate columns to count values

vjtianmsft_0-1729819865911.png

 

 

Table 2 = 
VAR _a = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.1] = "Wheel repair"),"a",'Table'[Repairs undertaken.1])
VAR _b = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.2]<>BLANK()),"a",'Table'[Repairs undertaken.2])
VAR _c = UNION(SUMMARIZECOLUMNS('Table'[Repairs undertaken.1],_a),SUMMARIZECOLUMNS('Table'[Repairs undertaken.2],_b))
RETURN
_c

 

 

 

values = 
 SWITCH(TRUE(),
 'Table 2'[Repairs undertaken.1]="Wheel repair",CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair")),
 'Table 2'[Repairs undertaken.1]="Creasing",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing")),
 'Table 2'[Repairs undertaken.1]="Welding",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))
 )

 

I've uploaded the corresponding pbix file, hope it helps.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,lbendlin ,thanks for your concern about this issue.

Your answer is excellent!
And I would like to share some additional solutions below.

Hello,@KathyO .I am glad to help you.
As lbendlin suggested, using inverse pivot is indeed a very good way to make the data more readable!
I'd like to suggest some additional suggestions below, which I hope will be helpful to you.

suggestion1.
Create measures directly.


vjtianmsft_0-1729819420220.png

 

 

Count_Creasing = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing"))



Count_Welding = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))


Count_Wheel repair = CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair"))

 

Put the measures to the pie graph.

suggestion2.
If your real data does match the screenshot you've shown, it's a good idea to create a table of calculations to visualize the results.

vjtianmsft_1-1729819546678.png

create calculate columns to count values

vjtianmsft_0-1729819865911.png

 

 

Table 2 = 
VAR _a = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.1] = "Wheel repair"),"a",'Table'[Repairs undertaken.1])
VAR _b = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.2]<>BLANK()),"a",'Table'[Repairs undertaken.2])
VAR _c = UNION(SUMMARIZECOLUMNS('Table'[Repairs undertaken.1],_a),SUMMARIZECOLUMNS('Table'[Repairs undertaken.2],_b))
RETURN
_c

 

 

 

values = 
 SWITCH(TRUE(),
 'Table 2'[Repairs undertaken.1]="Wheel repair",CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair")),
 'Table 2'[Repairs undertaken.1]="Creasing",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing")),
 'Table 2'[Repairs undertaken.1]="Welding",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))
 )

 

I've uploaded the corresponding pbix file, hope it helps.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Why would you think a pie chart is an appropriate representation of the story you are trying to tell with the data?

 

Unpivot your source data to bring it into a usable format, then the chart type of your choice will "just work".

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.