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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
new_learner
New Member

Aggregation of data by calculating percentage in each category

Hello Everyone,

I have a dataset that is imported in the desktop version and includes city names and the success of a test in those cities as follows. test_success is a binary column where 1 represents success.

citytest_success
a1
b0
c0
a1
d1
c0
b1

 

I would like to create a table or pie chart that shows the total number of tests held in each city as well as the proportion of success of the tests in each city, so the outcome would show three columns:

 

  •  city
  • total number of success 
  • percentage of success rate in each city

 

 

So, in this case, the percentage of success rate in each city is equal to the total number of success divided by the total number of tests in each city.

 

I hope someone can help me with this request.

 

Much appreciated

 

1 ACCEPTED SOLUTION
sayaliredij
Solution Sage
Solution Sage

You can calculate in following way

 

Total Tests = COUNT('Table'[Test_Success])
 
Success Test = SUM('Table'[Test_Success])
 
% success = [Success Test]/[Total Tests]




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
sayaliredij
Solution Sage
Solution Sage

Thank you for your reply 🙂 

 

Could you please Mark my post as a solution?

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




sayaliredij
Solution Sage
Solution Sage

You can calculate in following way

 

Total Tests = COUNT('Table'[Test_Success])
 
Success Test = SUM('Table'[Test_Success])
 
% success = [Success Test]/[Total Tests]




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@sayaliredij It worked well, thanks so much and have a good day!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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