The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
)
)
Solved! Go to Solution.
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
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
Hi @powerbi__2025,
We wanted to kindly follow up to check if the issue is resolved?
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
Hi @powerbi__2025,
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.
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 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
8 | |
8 |