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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
acg
Resolver I
Resolver I

Percentage of all Students spending more than 3 hours on their homework needed

This query gives me the nuber of students spending more tha 3 hours on heir home work. 

How do I work out what the percentage is of those against the total student population?

 

homework_OT    - this is the main dataset

homework_OT[StudentID] -  all the students and their IDs are in [StudentID]

homework_OT[OT 3HRS PLUS] =1  - this is to filter out all those students that have a 1 in [OT 3HRS PLUS] to indicate that they spent more than 3 hours on their homework

 

 

What calculation will give me the % of [OT 3HRS PLUS] =1 from the total student population? 

 

 

CNT Homework  > 3 HRS =
CALCULATE (
DISTINCTCOUNT( homework_OT[StudentID]),
FILTER ( homework_OT, homework_OT[OT 3HRS PLUS] =1 )
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@acg , Try a measure like

 


CNT Homework > 3 HRS =
divide( CALCULATE (
DISTINCTCOUNT( homework_OT[StudentID]),
FILTER ( homework_OT, homework_OT[OT 3HRS PLUS] =1 )
), DISTINCTCOUNT( homework_OT[StudentID]))

 

or

 

CNT Homework > 3 HRS =
divide( Countx (FILTER (
values( homework_OT[StudentID]), calculate(sum(homework_OT[OT 3HRS PLUS])) >=1 ), [StudentID]), DISTINCTCOUNT( homework_OT[StudentID]))

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

1 REPLY 1
amitchandak
Super User
Super User

@acg , Try a measure like

 


CNT Homework > 3 HRS =
divide( CALCULATE (
DISTINCTCOUNT( homework_OT[StudentID]),
FILTER ( homework_OT, homework_OT[OT 3HRS PLUS] =1 )
), DISTINCTCOUNT( homework_OT[StudentID]))

 

or

 

CNT Homework > 3 HRS =
divide( Countx (FILTER (
values( homework_OT[StudentID]), calculate(sum(homework_OT[OT 3HRS PLUS])) >=1 ), [StudentID]), DISTINCTCOUNT( homework_OT[StudentID]))

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.