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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
smedina25
New Member

Calculation

I have a cloumn and I want to canculate the value in percent relative to the whole table like example I have 500 rows and I have 3 categaries on one field L for loss, A for active and G for.. whaterver, I want to calculate the following G+A/ 500, how can I do this?

1 ACCEPTED SOLUTION
SamLester
Microsoft Employee
Microsoft Employee

Assuming that you've loaded this data into your model in Power BI Desktop, you can create a measure to calculate this value:

 

Calc = (CALCULATE(COUNTROWS(Results),Results[Result] = "G") + CALCULATE(COUNTROWS(Results),Results[Result] = "A")) / COUNTROWS(Results) 

 

Explanation:

The CALCULATE funtion takes an expression and a filter. In this case, the filter is used to count occurences of "G" and "A".  You can sum them and then divide by the total using COUNTROWS.

 

Thanks,
Sam Lester (MSFT)

View solution in original post

2 REPLIES 2
SamLester
Microsoft Employee
Microsoft Employee

Assuming that you've loaded this data into your model in Power BI Desktop, you can create a measure to calculate this value:

 

Calc = (CALCULATE(COUNTROWS(Results),Results[Result] = "G") + CALCULATE(COUNTROWS(Results),Results[Result] = "A")) / COUNTROWS(Results) 

 

Explanation:

The CALCULATE funtion takes an expression and a filter. In this case, the filter is used to count occurences of "G" and "A".  You can sum them and then divide by the total using COUNTROWS.

 

Thanks,
Sam Lester (MSFT)

Here's an example using 20 rows, with 13 G's and 2 A's, along with the measure formula showing the calculation of 0.75. You could convert this to a percentage if you wanted it to read 75% in this case.

 

Calculate.PNG

 

Thanks,
Sam Lester (MSFT)

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.