Forum Discussion

PaulHallam's avatar
PaulHallam
Helper III
1 year ago

Remove slicer selection from measure.

Hi,

I have the following measure which calculates the count of rows if Table 1 [Category] is “High” or “Medium” by date and returns the Max value for selected Year/Months from a slicer on the report page.

High&MedMax =

MAXX(

    KEEPFILTERS(VALUES('Table 1'[Date])),

    CALCULATE(

COUNTA('Table 1' [Category]),

OR ('Table 1' [Category]="High",('Table 1' [Category]="Medium ")

)))

What I need is the same calculation, but I want to ignore the Year/Months slicer so I get a maximum over all time rather than by Year/Month. I have tried various removefilters options but can’t seem to crack it,

Can anyone help?

6 Replies

  • Hi PaulHallam -can you create below measure 

    High&MedMax_AllTime =
    MAXX(
    KEEPFILTERS(VALUES('Table 1'[Date])),
    CALCULATE(
    COUNTA('Table 1'[Category]),
    FILTER(
    ALL('Table 1'), // Removes all filters from Table 1
    'Table 1'[Category] = "High" || 'Table 1'[Category] = "Medium"
    )
    )
    )

     

    i am using removefilter function try it and let know.

    • PaulHallam's avatar
      PaulHallam
      Helper III

      Hi,

      This is removing all filters from the Table 1 and is giving a result in the 1,000s. 

       

      High&MedMax =

      MAXX(

          KEEPFILTERS(VALUES('Table 1'[Date])),

          CALCULATE(

      COUNTA('Table 1' [Category]),

      OR ('Table 1' [Category]="High",('Table 1' [Category]="Medium ")

      )))

       

      The measure above works by counting rows of "High" & "Medium" per date and then returning the maximum. This can then be sliced by dates on  report page and it seems to work
      I need the exact same measure but for it to not to react with the dates slicer on the report page.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi PaulHallam ,

         

        You could be clearing the date table context with ALL():

        High&MedMax_NoDateFilter = 
        MAXX(
            KEEPFILTERS(VALUES('Table 1'[Date])),
            CALCULATE(
                COUNTA('Table 1'[Category]),
                OR('Table 1'[Category] = "High", 'Table 1'[Category] = "Medium"),
                ALL('Table 1'[Date])
            )
        )
        

         

        Hope it helps!

         

        Best regards,
        Community Support Team_ Scott Chang

         

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