Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Dynamic isfiltered dax expression

Hi Experts,   I have a scenario as follows:   If filter (slicer) does not have any selected value (Year/Month) then the table should show current months sales. when the Year/Month is filtered (s...
  • v-frfei-msft's avatar
    7 years ago

    Hi Anonymous ,

     

    To create a measure as below.

     

    measure = 
    VAR sum1 =
        SUM ( 'Table'[value] )
    VAR sumcurrecnt =
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER (
                'Table',
                YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
                    && MONTH ( 'Table'[Date] ) = MONTH ( TODAY () )
            )
        )
    RETURN
        IF ( ISFILTERED ( 'Table'[year month] ), sum1, sumcurrecnt )
    

    Pbix as attached.