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
dshao
Helper I
Helper I

Cannot slice because of function ALL

I am displaying a table below on my report:

 

dshao_0-1677073191905.png

 

The rows are measures calculated from Table T1. The measure used to calculate the bottom row is:

 

CALCULATE(sum(T1[Count]), FILTER(
                    ALL(T1),T1[dateend] >= SELECTEDVALUE('Date'[WeekEndDate]) - 6
                                 && T1[dateend] <= SELECTEDVALUE('Date'[WeekEndDate]))
                )
 
The purpose of this measure is to only count when dateend from T1 falls within the selected week in the table above.
 
The problem I am having is that I want to filter by userid in T1. When I selected a value from a slicer which the field is userid, the table above does not change. 
 
What I can do so that my slicer with userid will work with the table above?
1 ACCEPTED SOLUTION
sebastiandyrby
Resolver I
Resolver I

Hi

I'm guessing you could replace the 'ALL(T1)' statement in your measure calculation with the ALLEXCEPT function. As stated in the documentiation (ALLEXCEPT function (DAX) - DAX | Microsoft Learn), this "Removes all context filters in the table except filters that have been applied to the specified columns".

 

So if you replace ALL(T1) with something like ALLEXCEPT(T1, T1[userid]), that would probably do the trick.

 

Best regards,

Sebastian

 

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

3 REPLIES 3
sebastiandyrby
Resolver I
Resolver I

Hi

I'm guessing you could replace the 'ALL(T1)' statement in your measure calculation with the ALLEXCEPT function. As stated in the documentiation (ALLEXCEPT function (DAX) - DAX | Microsoft Learn), this "Removes all context filters in the table except filters that have been applied to the specified columns".

 

So if you replace ALL(T1) with something like ALLEXCEPT(T1, T1[userid]), that would probably do the trick.

 

Best regards,

Sebastian

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

After some further digging, I discovered that my slicer was user T1[username], not T1[userid]. I added T1[username] in the ALLEXCEPT columns and it worked!

 

My final query was:

CALCULATE(sum(T1[Count]), FILTER(
                    ALLEXCEPT(T1,T1[userid],T1[username]),T1[dateend] >= SELECTEDVALUE('Date'[WeekEndDate]) - 6
                                 && T1[dateend] <= SELECTEDVALUE('Date'[WeekEndDate]))
                )
 

Hi Sebastian,

 

Thanks for your response. I modified the query to:

 

CALCULATE(sum(T1[Count]), FILTER(
                    ALLEXCEPT(T1,T1[userid]),T1[dateend] >= SELECTEDVALUE('Date'[WeekEndDate]) - 6
                                 && T1[dateend] <= SELECTEDVALUE('Date'[WeekEndDate]))
                )
 
The slicer on userid does not change the numbers in the table.
 
 

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.