Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
mertolocel
Frequent Visitor

REMOVEFILTERS Confusing Behavior

Hello,

I came upon a case which got me super confused about the way DAX works. I'd appreciate it if you guys could take a look. 

 

Here is my model, there are 3 tables date, dim and fact as below : 

mertolocel_0-1707913164857.png

 

I was trying to come up with a measure that would count the rows in the fact table, with certain date filters from the fact table while completely ignoring the link between dim[Created Date] and date[Date Actual]

 

Starting off in very high confidence, I have written the following DAX and put it in a table with date[Year Month] : 

 

mertolocel_1-1707913357357.png

 

I got super confused seeing the result, because I was expecting the REMOVEFILTERS to remove the filters from the Created Date which was being passed on from the date[Year Month]. So, in Feb 24 I was only seeing tools with the Created Date = Feb 24.

 

mertolocel_3-1707913824352.png

 

Then I assumed that it was related to REMOVEFILTERS itself, so I've tried it with ALL( dim[Created Date] ), ALLSELECTED, ALLEXCEPT,  KEEPFILTERS and even CROSSFILTER( dim, date, NONE ). Nothing worked. I was always seeing the Feb 24 values for only the items with [Created On] = Feb 24. It looked like it was still filtering through that dim-date connection. 

 

At this point, I started questioning my DAX knowledge and came up with me missing something very fundamental. 

 

When I deactivate the relationship between dim and the date, it works exactly as intended as below.

 

mertolocel_5-1707914148320.png

 

 

I was able to solve this finally, by wrapping the fact table with an ALL so the Created On filter stopped flowing to my fact table and the measure worked : 

mertolocel_6-1707914483781.png

 

 

But this has been giving me sleepless nights, it has almost became an obsession.

I don't know how many pages of DAX questions I've read and how many ChatGPT prompts I've written, it always comes down to the usage of REMOVEFILTERS or ALL to ignore this relationship and see the visual as intended even with the relationship being active. 

 

Just wanted to see if anyone else had the confusion of this behavior and somehow find a way to understand it,

Thank you.

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mertolocel , Use it in countx like this

 

CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Table'[Date]) && (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Table'[Date]))),(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Table'[Date],None))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
mertolocel
Frequent Visitor

Oh my god man, I can die in peace now. Thank you so much. 

I love your content by the way, 

Cheers.

amitchandak
Super User
Super User

@mertolocel , Use it in countx like this

 

CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Table'[Date]) && (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Table'[Date]))),(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Table'[Date],None))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.