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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Calculate average number of attempts to get sufficient per course

I have the following table:

 

studnr/course/result

102A4,6 
103A6,6 
101A3,7 
105A9,1 
101A7 
102B4,4 
102B5,4 
104B4,6 
105B3,9 
105B6,1 
104B7,8 
101B3,1 
101B3,5 
101B7,6 
102B3,1 
102C3,3 
102C4,5 
102C6,3 
104C5,6 
105C5,6 
101D5,3 
101D4,6 
104D4,9 
105D3,1 
105D4,5 

 

I need to calculate the average number of attempts needed to get a sufficient per course.

This is, quite simply, the following formula:

No. of Attempts / No. of Sufficients

 

I've done this by using a measure but I did not get the right answer since the No. of Attempts should only be counted if the student also has got a sufficient.

 

Hopefully this is enough information to go on.

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous 

Is this the same question as this post?

https://community.powerbi.com/t5/Desktop/Apply-filter-on-measure/m-p/847800#M406924

If so, the solution should be the same.

Avg to sufficient = 
VAR _sufficient = 5.5
VAR _Students = 
    FILTER (
        SUMMARIZE(Results,Results[Student],Results[Course]), 
        CALCULATE(
            MAX ( Results[Result] )
        ) > _sufficient 
    )
VAR _Classes = CALCULATE ( COUNTROWS ( Results ), _Students )
RETURN DIVIDE ( _Classes, COUNTROWS( _Students ) )

I have attached my working file for you to take a look at.

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@Anonymous 

Is this the same question as this post?

https://community.powerbi.com/t5/Desktop/Apply-filter-on-measure/m-p/847800#M406924

If so, the solution should be the same.

Avg to sufficient = 
VAR _sufficient = 5.5
VAR _Students = 
    FILTER (
        SUMMARIZE(Results,Results[Student],Results[Course]), 
        CALCULATE(
            MAX ( Results[Result] )
        ) > _sufficient 
    )
VAR _Classes = CALCULATE ( COUNTROWS ( Results ), _Students )
RETURN DIVIDE ( _Classes, COUNTROWS( _Students ) )

I have attached my working file for you to take a look at.

Anonymous
Not applicable

Thank you for your answer, it is indeed correct.

 

Sorry for posting a duplicate question, I searched for it but could not find it.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors