March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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.
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 statistics
and then
lessThan90=
CALCULATE(
DISTINCTCOUNT('SessionAttendance'[StudentID]),
FILTER('SessionAttendance', [Attendance Rate]<=0.9)
)
Let me know if this helps.
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?
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
I'm thinking something like this, although I admittedly don't know whether ADDCOLUMNS() will accept a measure as expression argument.
var t_Attendance=
ADDCOLUMNS('SessionAttendance', "att_Rate", [Attendance Rate])
return
CALCULATE(
COUNTROWS('t_Attendance'[StudentID]),
FILTER(att_Rate<=0.9)
)
Let me know how it goes.
Thank you. I gave that a try but all I got back was error saying the Basetable was missing.
However I did start getting a bit creative about creating a temporary Summarise table and ended up with the following measure:
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 Marks
then 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.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
89 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |