Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Experts,
I'm working on a Power BI report where the requirement is to calculate the total number of students who have passed all their subjects within a selected date range.
A student is considered as "Passed" only if they have passed all subjects—even if one subject is failed, the student should be treated as "Failed".
I have a working DAX measure that gives the correct result when only today's date is selected. However, when a date range is selected using the slicer (e.g., yesterday + today), it does not return the correct count. It seems to only consider part of the range or just one date.
@lbendlin
Total_Students_Passed :=
CALCULATE(
DISTINCTCOUNT('Sheet1'[Student]),
FILTER(
VALUES('Sheet1'[Student]),
CALCULATE(
COUNTROWS(
FILTER(
'Sheet1',
'Sheet1'[Exam_Result] = "Fail"
)
)
) = 0
)
)
Hi @powerbi__2025,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @johnt75 for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user resolved your issue? or let us know if you need any further assistance.
If any response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Thanks and regards,
Anjan Kumar Chippa
Try
Total Students Passed =
VAR StudentsNumFails =
ADDCOLUMNS (
VALUES ( Sheet1[Student] ),
"@num fails", COALESCE ( CALCULATE ( COUNTROWS ( Sheet1 ), Sheet1[Exam_Result] = "Fail" ), 0 )
)
VAR Result =
COUNTROWS ( FILTER ( StudentsNumFails, [@num fails] = 0 ) )
RETURN
Result
User | Count |
---|---|
16 | |
14 | |
13 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
15 | |
11 | |
10 |