Forum Discussion

dokat's avatar
dokat
Icon for Post Prodigy rankPost Prodigy
3 years ago
Solved

Ignore all slicers except for one

Hi,   I am have a report where i'd like to ignore all slicer selections except for CY[Slicer]. I am using below code however it returns attached error message. Is there a work around this issue? ...
  • dokat's avatar
    dokat
    3 years ago

    danextian  Thanks for your response rather than using allexcept removefilters/values did the trick.

    Output Fixed GP Rate = 
    VAR _GP =
        CALCULATE (
            ('Output'[Output TY]),
              REMOVEFILTERS ( 'Output' ),
              ValueS('CY'[SLICER]),
            'Output'[P&L] = "Gross Profit"
        )
        
    VAR _NS =
        CALCULATE (
            ('Output'[Output TY]),
              REMOVEFILTERS ( 'Output' ),
              ValueS('CY'[SLICER]),
            'Output'[P&L] = "Net Sales"
        
        )
    RETURN
        IF (
            ISBLANK ( DIVIDE ( _GP, _NS ) )
                || DIVIDE ( _GP, _NS ) = 0,
            SELECTEDVALUE ( 'CY'[Slicer] ),
            DIVIDE ( _GP, _NS )
        )