Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, i have a table displaying the weekly average attendance of a student:
It is calculated using a 'rolling' average, so:
week 1 actual (05/09/2022) = 100%
week 1 rolling (05/09/2022) = 100%
week 2 actual (12/09/2022) = 90%
week 2 rolling (12/09/2022) = 95% (100+90 = 190, /2 = 95%)
week 3 actual (19/09/2022) = 100%
week 3 rolling (19/09/2022) = 96.67% (100+90+100= 290, /3 = 96.67%)
The DAX for this measure is:
Weekly % Attendance (Rolling) =
AVERAGEX(
FILTER( ALLSELECTED( 'powerbi_attendance_weekly_average' ),
'powerbi_attendance_weekly_average'[Mark Date (Weeks DD/MM/YY)] <= MAX (powerbi_attendance_weekly_average[Mark Date (Weeks DD/MM/YY)])), 'powerbi_attendance_weekly_average'[Weekly % Attendance])
This seems to work fine in a PBI table when the table is filtered to a single student, as above, but when I try to display multiple students, this is the result:
I suspect the value is a combined value for all students. These are fictitious names, I should add.
Hope somebody can give me some pointers with this, many thanks
Solved! Go to Solution.
Hi @iansimpson888 ,
I suggest you to try ALL() and add [Full Name] column into filter code part.
Weekly % Attendance (Rolling) =
AVERAGEX (
FILTER (
ALL ( 'powerbi_attendance_weekly_average' ),
'powerbi_attendance_weekly_average'[Mark Date (Weeks DD/MM/YY)]
<= MAX ( powerbi_attendance_weekly_average[Mark Date (Weeks DD/MM/YY)] )
&& 'powerbi_attendance_weekly_average'[Full Name]
= MAX ( 'powerbi_attendance_weekly_average'[Full Name] )
),
'powerbi_attendance_weekly_average'[Weekly % Attendance]
)
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @iansimpson888 ,
I suggest you to try ALL() and add [Full Name] column into filter code part.
Weekly % Attendance (Rolling) =
AVERAGEX (
FILTER (
ALL ( 'powerbi_attendance_weekly_average' ),
'powerbi_attendance_weekly_average'[Mark Date (Weeks DD/MM/YY)]
<= MAX ( powerbi_attendance_weekly_average[Mark Date (Weeks DD/MM/YY)] )
&& 'powerbi_attendance_weekly_average'[Full Name]
= MAX ( 'powerbi_attendance_weekly_average'[Full Name] )
),
'powerbi_attendance_weekly_average'[Weekly % Attendance]
)
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@iansimpson888 Drop your ALLSELECTED.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |