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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Create a Filtered Denominator for a Divide Function from one table in another table

I have two tables, Table 1 has Athletic team enrolments and Table 2 has full school enrolments I need to calculate participation on each team by school level and grade level which are fields in Table 2. 

 

My calculation should be take the sum of enrolments from Table 1 and then create the denominator filtering Table Two to count only students in Senior School (or Middle School or Junior School). Same concept for each grade level. 

 

I can manually input =COUNTA('AthleticEnrolment'[Enrolment])/504 to get the Participation rate for Senior School students on each team but the data tables are live and the denominator should change based on student withdrawals or new student arrivals. 

 

The School Level data is text type. The Filter functions I have been trying fail because I cannot use text and integer data in the formulas I have tried.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Anonymous 

You can try using VAR, IN, DIVIDE DAX functions for calculations. Based on your description, I created the following data:

vjianpengmsft_0-1708484350900.png

vjianpengmsft_1-1708484425936.png

Find the ParticipationRate by establishing a measure similar to the following:

ParticipationRate = 
var _a=CALCULATE(SUM(Sheet1[Enrollment]))
var _b = CALCULATE(SUM(Sheet2[TotalEnrolment]),FILTER('Sheet2','Sheet2'[SchoolLevel] IN{"senior middle school","middle school"}))
RETURN DIVIDE(_a,_b)+0

vjianpengmsft_2-1708484653907.png

Use filter to filter the categories in Table 2 where the School level is high school or junior high school. Then sum the TotalEnrolment in this table after filtering. You can also use the && symbol to combine more conditions, like:

FILTER('Sheet2','Sheet2'[SchoolLevel] IN{"senior middle school","middle school"}&&'Sheet2'[Grade]="grade 9")

This sum can be replaced by your COUNTA expression, using aggregate functions based on your data. Use the DIVIDE function at the end to calculate the ParticipationRate.

Use the newly created measure and related columns in the Table visual:

vjianpengmsft_3-1708485031434.png

Measure will be calculated row by row based on the external filter Team Name, Grade and your Filter function. If the above suggestions are helpful to you, that would be great.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

1 REPLY 1
Anonymous
Not applicable

Hi, @Anonymous 

You can try using VAR, IN, DIVIDE DAX functions for calculations. Based on your description, I created the following data:

vjianpengmsft_0-1708484350900.png

vjianpengmsft_1-1708484425936.png

Find the ParticipationRate by establishing a measure similar to the following:

ParticipationRate = 
var _a=CALCULATE(SUM(Sheet1[Enrollment]))
var _b = CALCULATE(SUM(Sheet2[TotalEnrolment]),FILTER('Sheet2','Sheet2'[SchoolLevel] IN{"senior middle school","middle school"}))
RETURN DIVIDE(_a,_b)+0

vjianpengmsft_2-1708484653907.png

Use filter to filter the categories in Table 2 where the School level is high school or junior high school. Then sum the TotalEnrolment in this table after filtering. You can also use the && symbol to combine more conditions, like:

FILTER('Sheet2','Sheet2'[SchoolLevel] IN{"senior middle school","middle school"}&&'Sheet2'[Grade]="grade 9")

This sum can be replaced by your COUNTA expression, using aggregate functions based on your data. Use the DIVIDE function at the end to calculate the ParticipationRate.

Use the newly created measure and related columns in the Table visual:

vjianpengmsft_3-1708485031434.png

Measure will be calculated row by row based on the external filter Team Name, Grade and your Filter function. If the above suggestions are helpful to you, that would be great.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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