Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Guys
I am currently working with attendance data of school learners. I would like to use a measure to calculate how many learners have attended more than once in a week across all weeks to date. I have a learner table, with unique learner number and date columns.
Hope you guys can help.
Thanks
Hi @HiltonS
This can definitely be done.
Just clarifying, do you want to calculate:
Owen
Thanks for the reply. More than once every week.
Suggested tables to make this work (Table: Columns):
Below is the measure I wrote to return the number of Learners who have attended more than once in every week so far.
To summarise what the measure is doing:
Number of Learners With More Than 1 attendance in all weeks to date = VAR ValuesLearners = VALUES ( Learner[Learner] ) VAR DatesUpToMaxDate = DATESBETWEEN ( 'Date'[Date], BLANK (), MAX ( 'Date'[Date] ) ) VAR MaxEndOfWeekDate = CALCULATE ( MAX ( 'Date'[Date] ), 'Date'[Last Day of Week], DatesUpToMaxDate ) VAR DatesUpToMaxCompleteWeek = DATESBETWEEN ( 'Date'[Date], BLANK (), MaxEndOfWeekDate ) VAR WeeksUpToMaxCompleteWeek = CALCULATETABLE ( VALUES ( 'Date'[Year-Week] ), DatesUpToMaxCompleteWeek ) RETURN CALCULATE ( COUNTROWS ( EXCEPT ( ValuesLearners, SELECTCOLUMNS ( GENERATE ( WeeksUpToMaxCompleteWeek, FILTER ( ValuesLearners, CALCULATE ( COUNTROWS ( Attendance ) ) < 2 ) ), "Learner", Learner[Learner] ) ) ), DatesUpToMaxCompleteWeek )
Anyway, I guess this will need adapting to your model.
Regards,
Owen
See below my direct adaption to what you sent me.
It doesnt seem to give any values. What have I done wrong?
Thanks for posting your file - useful to have a look at your actual data.
Haven't had a chance to work out the solution, but there are two issues I can see:
I will have a look into these points and get back to you. Let me know if you make any progress yourself.
Regards,
Owen 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |