Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Below I have a sample table of students in different subjects. I am trying to write a DAX function that will return the count of Students who are failing 2 or more subjects. In the below table, this would be student 1 and student 3, so ideally the DAX function would return a value of 2.
| Subject | Student | Pass_Fail |
| 1 | 1 | 0 |
| 2 | 1 | 0 |
| 3 | 1 | 1 |
| 1 | 2 | 1 |
| 2 | 2 | 1 |
| 3 | 2 | 1 |
| 1 | 3 | 0 |
| 2 | 3 | 0 |
| 3 | 3 | 0 |
This is the function I tried to write, but I receive an error that says there are more than a million rows (dataset is quite large) when all I want is one nominal value. Appreciate any assitance!
Failing2Subjects =
COUNTROWS (
FILTER (
SUMMARIZE (
StudentTable,
StudentTable[Student],
StudentTable[Subject],
"Fails",
COUNTX (
FILTER ( StudentTable, StudentTable[Pass_Fail] = 0 ),
StudentTable[Pass_Fail]
)
),
[Fails] > 1
)
)
Please try one of the following
Failing2Subjects =
COUNTROWS (
FILTER (
ADDCOLUMNS (
SUMMARIZE (
FILTER ( StudentTable, StudentTable[Pass_Fail] = 0 ),
StudentTable[Student]
),
"@NumOfFails", CALCULATE ( COUNTROWS ( StudentTable ) )
),
[@NumOfFails] > 1
)
)Failing2Subjects =
SUMX (
SUMMARIZE (
FILTER ( StudentTable, StudentTable[Pass_Fail] = 0 ),
StudentTable[Student]
),
CALCULATE ( IF ( COUNTROWS ( StudentTable ) > 1, 1 ) )
)
Hello, thanks again for getting back!
The first one I get this error:
With the second one I get the 1,000,000 rows error again.
Starting to think this isn't possible with DAX. Really appreciate the assistance and ideas though!
Hi @Mactoff
Please try
Failing2Subjects =
COUNTROWS (
FILTER (
SUMMARIZE (
FILTER ( StudentTable, StudentTable[Pass_Fail] = 0 ),
StudentTable[Student],
"@NumOfFails", COUNTROWS ( StudentTable )
),
[@NumOfFails] > 1
)
)
Thanks for getting back! I still get the million rows error unfortunately. I should mention that there a lot of other columns in the table. The table I showed in my example is the table summarized down (the way I think it needed to be).
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 58 | |
| 45 | |
| 41 | |
| 21 | |
| 18 |