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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
anshpalash
Helper II
Helper II

Division Calculation by Filters

Hi all,

 

I have a dataset similar to the form:

MonthDefect CodeDefect Count
121210
160020
166510
299915
290015
213710

 

I want to calculate defect% per month and defect code. For example, the defect% for month 1 and code 212 would be the number of defects for the code 212 in month 1 divided by the total number of defects in that month. So, defect% in this case would be 10/(10+20+10) = 0.25 or 25%.

I want to create a line graph that would show defect%. In this line graph, the axis would be months (1,2,..), the legend would be defect codes and the values would be defect%. Can anyone please help me on how I can achieve this? Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Create a column and paste this code 
 
Column = DIVIDE('Table'[Defect Count],CALCULATE(SUM('Table'[Defect Count]), ALLEXCEPT('Table','Table'[Month])),0)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Create a column and paste this code 
 
Column = DIVIDE('Table'[Defect Count],CALCULATE(SUM('Table'[Defect Count]), ALLEXCEPT('Table','Table'[Month])),0)

Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.