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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
TFTF_BI
Helper I
Helper I

Filter a count using the result of a calculated measure for values greater than 0

Hi Guys, Im stuck on the below. Im guessing im overthinking this. 

So I have created a measure which gives me a total average percentage of increase or decrease. Example:

 

Im comparing students attendance against 2 time frames. 'this part works fine' 

 

Time frame 1 = 70% average over 20 students 

Time frame 2 = 90% average over the same 20 students

giving me an average increase of 28.5% 

 

My measure called (attandance_variance) gives my 28.5% when comparing the dynamic time frames selected.

 

I now need to workout a hit rate within this measure. So I need to find out how many of the 20 students improved their attendance vs the previous time frame. 

 

I was hoping I could use this measure within a new measure and use the count function and filter it by scores over above 0. but this does not seem to be working for me. Example: 

 

Count_Students_Attendance_Improved =
CALCULATE(COUNT(Students[school_student_id]),
FILTER('Attendance_Measures',[attendance_variance]>1))
 
It was a long shot hoping it would work like a table filter but unfortantly its not reconising the filter. Every part of this is dynamic hence not using calculated columns. 
 
I would love some help in solving this problem. 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@TFTF_BI , Try like

 

Count_Students_Attendance_Improved =
COUNTX(FILTER(values(Students[school_student_id]),[attendance_variance]>1),[school_student_id])

 

TO filter measure you need push a group by , values is doing same here

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Tutu_in_YYC
Super User
Super User

Hi TFTF_BI,

Try changing the table in the filter context to the Students table. Because that is the table that you would like to filter, not Attendance_Measures.

Count_Students_Attendance_Improved =

CALCULATE(
DISTINCTCOUNT(Students[school_student_id]),
FILTER(
'Students',
[attendance_variance]>1
)
)

 

 

This is assuming the column [school_student_id] is distinct and the attendance_variance measure works with single students.

amitchandak
Super User
Super User

@TFTF_BI , Try like

 

Count_Students_Attendance_Improved =
COUNTX(FILTER(values(Students[school_student_id]),[attendance_variance]>1),[school_student_id])

 

TO filter measure you need push a group by , values is doing same here

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Awesome, Would it be similer if I wanted to return the average increase for those have increased? 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.

Top Solution Authors