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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

New Member

DAX RemoveFilters issue --SOLVED

I am trying to get a RemoveFilters function to work. 

Basically, I want to get a Count of ID in QtData for a specific EquipmentGroup and TimePeriod that ignores any Slicers that impact the Visual Page.  As it's ignoring the Slicers, however, I would like to get a count of all the values created in the past 6 months.  Below is what I have:



M_6MonthQtCt_Type1-Type2 = 
    COUNT ( QtData[Id] ),
    FILTER (
        ALL ( EquipmentSelect ),
        EquipmentSelect[TypeGrouping] IN { "Type1", "Type1" }
    FILTER ( ALL ( 'QtData' ), QtData[qtDate] >= 'Calendar'[M_6MonthsPrev] )



with M_6MonthsPrev as:



M_6MonthsPrev = EDATE(TODAY(), -6)




I've inlcuded the Data Model below and highlighted the various relations.  In the DAX I have so far, I'm only trying to remove the filters on the EquipmentSelect and Calendar table (since I can't get this simple version to work for me yet) but I will eventually add in REMOVEFILTERS, or whatever the correct process is, to remove QtType, QtStatus, EmployeeTeam, and PartnerName, and the filters to PartnerName.

Look forward to any insights on what I'm doing incorrectly here!


***Edit:  As a note, I need to use Calculate, instead of, say, a CountRows (if that would work), as I'll also want to get the SUM of QuotedValue at a later time.




UPDATE:  Solution found

M_6MonthQtCt_Type1-Type2 = 
    , ALL(DateRangePicker) 
    , FILTER ( ALL ( 'QtData' )
    , QtData[qtDate] >= 'Calendar'[M_6MonthsPrev] ) 
    , EquipmentSelect[TypeGrouping] IN { "Type1", "Type2" } 

Greg's solution probably would have worked, but found this before figuring out how to implement my solution.

Super User
Super User

@eaglesilo Let's say that Type1 and Type2 have ID's of 1 and 2, you could do this:

M_6MonthQtCt_Type1-Type2 = 
  VAR __Table = FILTER( ALL( 'QtData'), EquipmentTypeId IN { 1, 2 } && [qtDate] >= [M_6MonthsPrev])
  VAR __Result = COUNTROWS( __Table )

If later you want to do a SUM, then you could replace COUNTROWS with SUMX.

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Ended up with the below as the solution:

M_6MonthQtCt_Type1-Type2 = 
    , ALL(DateRangePicker) 
    , FILTER ( ALL ( 'QtData' )
    , QtData[qtDate] >= 'Calendar'[M_6MonthsPrev] ) 
    , EquipmentSelect[TypeGrouping] IN { "Type1", "Type2" } 


I think your solution would have worked, but EquipmentType.TypeGrouping contains many TypeIDs and this allows for the IDs in the group to change server side and flow through to PBI.  (The EquipmentSelect table is pulled directly from SQL and managed and updated within there)

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.