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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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))

 

 

@amitchandak,

That doesn't work.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.