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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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]))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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]))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.