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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
anandav
Skilled Sharer
Skilled Sharer

Help with ALL function

Hi Experts,

 

I have the following measure:

Customer subset =
Var vAG = DISTINCT(
SELECTCOLUMNS(FILTER(ALL(Sales), MONTH(Sales[Sale Date]) IN ALLSELECTED('Analysis Group Calendar'[Month])),
"AG Customers", Sales[Sale Cust])
)
RETURN
CALCULATE(DISTINCTCOUNT(Sales[Sale Cust]), vAG)
 
This returns the correct value when there are NO relationship among the tables.
 
ModelwithNoRelationships.png
 
But when there are relationship with tables, and when there is a slicer selection of the Calendar table, the measure does not work.
ModelwithRelationships.png
 
I can understand that the Calendar slicer is filtering the Sales.
Eventhough there is ALL(Sales) I have no way of adding another condition for ALL(Calendar) in the above SELECTCOLUMNS statement.
 
How can I rewrite the above measure so it will ignore any filters in Sales and Calendar?
 
Your help will be much appreciated.
 
Thanks,
Anand
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @anandav 

I create a measure which show the same result as your Customer subset measure when there is no relationship among tables.

Measure =
CALCULATE (
    DISTINCTCOUNT ( sales[sale cust] ),
    FILTER (
        ALL ( sales ),
        sales[sale date] <= MAX ( 'filter date table'[Date] )
            && sales[sale date] >= MIN ( 'filter date table'[Date] )
    )
)

Capture10.JPGCapture11.JPG

 

Also this measure won't change with the slicer from "calendar[date]".

Capture12.JPG

Capture13.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-juanli-msft
Community Support
Community Support

Hi @anandav 

I create a measure which show the same result as your Customer subset measure when there is no relationship among tables.

Measure =
CALCULATE (
    DISTINCTCOUNT ( sales[sale cust] ),
    FILTER (
        ALL ( sales ),
        sales[sale date] <= MAX ( 'filter date table'[Date] )
            && sales[sale date] >= MIN ( 'filter date table'[Date] )
    )
)

Capture10.JPGCapture11.JPG

 

Also this measure won't change with the slicer from "calendar[date]".

Capture12.JPG

Capture13.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-juanli-msft ,

Thanks a lot for the help and really appreciate it. That works perfectly. Smiley Happy

 

Ashish_Mathur
Super User
Super User

Hi,

It will be a lot easier to help if you share some data, explain the business context and also show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PaulDBrown
Community Champion
Community Champion

@anandav 

Not too sure, but I believe the new REMOVEFILTERS can remove all filters: REMOVEFILTERS ().





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown,

Thanks for the suggestion. But FILTER doesn't accept REMOVEFILTERS()

From DAX.guide:

REMOVEFILTERS is an alias for ALL, but it can be used only as a CALCULATE modifier and not as a table expression like ALL

Can it be done calculate by using cross filter or cross join

 

CALCULATE(DISTINCTCOUNT(Sales[Sale Cust]), vAG,crossfilter(<>,<>,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

@amitchandak,

That doesn't work.

I need a way to remove filters in Sales and Calendar table in the SelectCOlimns statement.

Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.