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
Bilal0336
Frequent Visitor

How to use FILTER with ALL?

I have a CALENDER table with LASTDAY column. On the page level I have applied filter:
CALENDER[LASTDAY] is on or after 1/1/2021

I have a slicer on the page having all the months. What I want to do is to compare ALLSELECTED(CALENDER[LASTDAY]) with ALL(CALENDER[LASTDAY]). But for the ALL(CALENDER[LASTDAY]) it is also neglecting Page Level filter values and considering all the values. So in that case, how can I use ALL and FILTER together?

 

What I want is: ALL should consider Page Level Filter because I need all values that are on or after 1/1/2021...  Please guide, I used this:


_DefaultALL =
COUNTX(FILTER(ALL(CALENDAR_DIM[LASTDAY]), CALENDAR_DIM[LASTDAY] >= 1/1/2022), CALENDAR_DIM[LASTDAY])

But it is not applying this CALENDAR_DIM[LASTDAY] >= 1/1/2022 to ALL(CALENDAR_DIM[LASTDAY]).

Thanks
@amitchandak @lbendlin 
1 ACCEPTED SOLUTION

The format of your lastday column is incorrect. Should say 

>= "2022-01-01"

View solution in original post

6 REPLIES 6
bcdobbs
Super User
Super User

I think you might possibly be misunderstanding ALLSELECTED. It bring back the filter context as it was at the creation of a visual (for example all the rows in the matrix rather than the current row).

 

ALLSELECTED effectively then gives you the values selected by any slicers/page filters. No way to separate where they came from.

 

ALL removes all filters including page filters.

 

Sure we can find a way round but it's not easy.

Are the page filters static? If so you could manually add them back into filter context.

 

Alternative approach would be to use a disconnect table to drive the slicer and then pass the filter in DAX using:

TREATAS (
    VALUES ( DiscTable[ColumnName] ),

    OrigTable ( ColumnName]
)

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Hi, Thanks for the response. Yes, page level filters are static and as mentioned above, I am trying to apply those manually to ALL():

_DefaultALL = COUNTX(FILTER(ALL(CALENDAR_DIM[LASTDAY]), CALENDAR_DIM[LASTDAY] >= 1/1/2022), CALENDAR_DIM[LASTDAY])

But somehow this filter CALENDAR_DIM[LASTDAY] >= 1/1/2022 is not getting applied.

How can we apply this?

Thanks.

The format of your lastday column is incorrect. Should say 

>= "2022-01-01"

Yes, thanks. I think you are correct. 🙂

lbendlin
Super User
Super User

ALL removes all filters. Use ALLSELECTED instead.

Thanks for replying. But I have to do a comparison of ALL() and ALLSELECTED(). 🙂
For example, I am selecting months from a slicer and........ IF(ALLSELECTED() = ALL(), DO THIS, DO THAT).

Any way of achieving this?

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.