Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am struggling to understand why my formula using AllExcept is not working as expected. My slimmed down model looks like the following:
Facilities.Id=> Surveys.FacilityId
Areas.Id => Surveys.AreasId
Facilities.Id => Areas.FacilityId
I am trying to get a count of all Surveys with all filters removed except the facility filter. So essentially, it's a count within the facility regardless of the other filter contexts.
My expectation was to be able to do
CALCULATE(COUNTROWS(Surveys), ALLEXCEPT(Surveys, Surveys[FacilityId]))
However, this yields a count of ALL survey records, and not just the surveys with the FacilityId filter applied. In addition, if I add that measure into my data table, it expands the currently selected facilities to all facilities (i.e. it essentially removes the facility filter on the data table).
My data table without the expression above and just a normal count looks like this and has 10 rows.
Adding in the measure with the formula above yields the table below with thousands of rows and a count of 1.4 million (when it should be 9678).
In trying to figure this out, I found that the following formula yields exactly what I want.
Total Facility Count = VAR SelectedFacilities = ALLSELECTED( Surveys[FacilityId], Surveys[SVSTATUS] )
RETURN
CALCULATE (
COUNTROWS ( Surveys ),
REMOVEFILTERS ( ),
VALUES ( Surveys[FacilityId] ),
SelectedFacilities
)
and
BUT I want to understand why the AllExcept version is behaving like it is. I am new to PowerBI and DAX so I am sure there is some fundamental concept that I am not picking up on. Any help explaining why the second query works as opposed to the first would be greatly appreciated.
from your snapshoot, can not what's the outsider filters.
for the DAX code, ALLEXCEPT(table,....), will get a table withe all columns and it will expand to all the dim table related, and remove the filters.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |