Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Avoid measure from ignoring slicer using ALL()

Hi. I am trying to display both the current and previous year's sales with a year slicer like so:

 

 

I am able to dynamically change the year perperly. Though, I want to be able to select the stores status was well ( 'Stores'[Status] ) and my measure for the previous year wont allow this since I am using an ALL() in the filter epxression. Below are both my measures:

 

TEST, YTD = SUM ( Sales[Sales] )
 
TEST, YTD LY = CALCULATE( [TEST, YTD], DATEADD(Sales[Date], -1, YEAR), ALL(Sales) )
 
I have two tables: 'Sales', with a [Sales] and [Dates] column, and 'Stores', with the [Status] column. There is a one to many connection from 'Stores' to 'Sales'. 
 
Is there a work around? Is it possible to even have the measures working with the status slicer? Thanks in advance!
  • Hi, Anonymous , you might want to specify column(s) in ALL() function to remove filter(s) on the assigned columns. I think this might do the trick.

    TEST, YTD LY =
    CALCULATE (
        [TEST, YTD],
        DATEADD ( Sales[Date], -1, YEAR ),
        ALL ( Sales[Date] )
    )

2 Replies

  • CNENFRNL's avatar
    CNENFRNL
    Icon for Community Champion rankCommunity Champion

    Hi, Anonymous , you might want to specify column(s) in ALL() function to remove filter(s) on the assigned columns. I think this might do the trick.

    TEST, YTD LY =
    CALCULATE (
        [TEST, YTD],
        DATEADD ( Sales[Date], -1, YEAR ),
        ALL ( Sales[Date] )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks so much! It now works as attended.