Forum Discussion
Some help required with a measure
Hi Everyone
I'm a little bit stumped with what I think should be quite easy but I'm not sure how to achieve it.
Here is what I need. I need a measure that counts the number of students where their attendance is less than or equal to 0.90.
Below is a sample from the Attendance Table which contains the date, Student ID and Attendance code for every date the student can possibly attend school. This contains upwards of 100,000 rows.
I have a measure that counts the number of present attendance codes.
and another that counts the total possible sessions.
7 Replies
- v-xiaotang
Community Support
Hi Simon_Evans
Thanks for reaching out to us.
>> I need a measure that counts the number of students where their attendance is less than or equal to 0.90.
try
attendance=Total Present Marks / Total Marksthen set it to 2 decimal places.
rows= calculate(countrows('table'),filter(all('table'), [attendance]<=0.9))Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
- Simon_Evans
Helper I
Hi v-xiaotang
Thank you for this, much apprecaited.
It certainy l;ooks a lot easier to read but it comes back with a value of well over 85,000 which is just less than half of all the rows in that table.
Any further ideas on this would be greatly appreciated.
- AnonymousNot applicable
Assuming any Attendance code will do, you could start by simplyfying your formula by using SessionAttendace[AttendanceCode]<>NULL().
My idea is:
Attendance Rate=
DIVIDE(
CALCULATE(
COUNT('SessionAttendance'[AttendanceCode]),
FILTER(SessionAttendance, [AttendanceCode]<>NULL()) //filter for sessions attended only
) //------------------------------------
COUNT('SessionAttendance'[AttendanceCode]), //I'm assuming there's no condition on
2 //what you consider as "Valid session"
) //for your statisticsand then
lessThan90=
CALCULATE(
DISTINCTCOUNT('SessionAttendance'[StudentID]),
FILTER('SessionAttendance', [Attendance Rate]<=0.9)
)Let me know if this helps.
- Simon_Evans
Helper I
Hi Anonymous
Thank you for this, much appreciated.
There are specific codes that need count towards what is an attended session and what is a possible session hence why two measures are very specific.
I like your idea and have tried it however the part where it just seems to not work is the Filter on the table for the attendance being less than 0.90.
Your idea comes back with a count of 449 distinct pupils which is exactly the number of unique student ID's of that table. What I'm aiming for is 33 (I've done a manual count).
If I was to create a calculated table which gives me each student with their own row and summaries of what there attendance is and if it is below 0.90 would that calculated table keeps itself up to date each time the date set is refreshed to bring in the latest attendance marks?
- Simon_Evans
Helper I
Ok scrap the idea of calculated table as that won't work as I need this measure to be able to be affected by a Date slicer