cancel
Showing results for
Did you mean:
Regular Visitor

## Calculating percentages within a group

I'd like to calculate count percentages within a group, not group percentages of an entire field/data set

Here's the measure:

`% of Students Growth > 1 = DIVIDE(CALCULATE(COUNTROWS(SAYOT_Student_diff), SAYOT_Student_diff[Diff] > 1), COUNTROWS(SAYOT_Student_diff))`

In English, the logic is to calculate the percentage of rows where Diff was greater than 1 per category, which is another field in the table

The measure works fine when no filters are applied, but produces weird results whenever I apply a filter. I've looked into ALLSELECTED but wasn't getting anything out of that

2 REPLIES 2
Super User

## Re: Calculating percentages within a group

Can you show your data model or share the pbix?

Is this the only table in your model? What slicers are you using when the measure doesn't work as expected?

Super Contributor

## Re: Calculating percentages within a group

Hi @kimchizal,

Based on my test, you could refer to below formula:

Sample data:

Create below measure:

`% of Students Growth > 1 = DIVIDE(CALCULATE(COUNT(SAYOT_Student_diff[Diff]),FILTER(ALL(SAYOT_Student_diff), SAYOT_Student_diff[Diff] > 1)), COUNTROWS(ALL(SAYOT_Student_diff)))`

Result:

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 116 members 1,638 guests
Recent signins: