Forum Discussion

vinaydavid's avatar
vinaydavid
Icon for Helper III rankHelper III
6 years ago
Solved

Slicer/Filter should not change the Measure calculation

Hi Experts,   Is there a way, where we can exclude the impact of Slicer/Filter on a Measure calculation?   Here is the situation, The below table calculation give me the right Percentage Categor...
  • edhans's avatar
    edhans
    6 years ago

    Just a clarification: The table would maintain interaction. I was suggesting selecting the slicer, going to interaction, and disabling the table only. All other visuals and slicers would still work on the table. Just turning it off for the date slicer. 

     

    Does the following work for you?

    New Percentage = 
    VAR Numerator =
        CALCULATE(
            SUM('Time Tracker Data'[Hours]),
            ALLEXCEPT(
                'Time Tracker Data',
                'Time Tracker Data'[Name],
                'Time Tracker Data'[LogDate],
                'Time Tracker Data'[Productive/ Non-productive]
            )
        )
    VAR Denominator =
        CALCULATE(
            SUM('Time Tracker Data'[Hours]),
            REMOVEFILTERS('Time Tracker Data'[Name],'Time Tracker Data'[LogDate])
        )
    RETURN
    DIVIDE(Numerator,Denominator,0)

     

    Here, the denominator ignores the context filters on the Name field and the log date field. 

    If that isn't what you want, you can change what fields are in the REMOVEFILTERS() function. At this point it is really figuring out which filters you want to keep, and those filters are povided by the table rows Name and Productive/Non-Productive (controlled by a slicer) and the log date. 

    I'm not sure I've helped too much here. I tend to do the math in Excel or on a calculator to know what results I want then work on the filters to make sure I get the right results, then make sure the audience will understand it without me having to explain for 15min what the calculation is doing.