Forum Discussion

yellowold5's avatar
yellowold5
Icon for Helper I rankHelper I
2 years ago
Solved

SSAS Current week if not filtred

Hi everyone, I have a report using live connection to a tabular cube, i have 3 slicer in that report:

I want have a visuals filter if those 3 slicer is not filtred then show current week of that otherwise selected filter data.

  • Hi yellowold5 

    Assuming that the week is based on the WEEKNUM function, you can use ISFILTERED to check whether a filter is applied directly to a column. Note: returns true if a filter is appleid directly to the column specified in the argument, not when it is crossfiltered.

    =
    IF (
        --Filters must be directly applied to these three column in order to return the filtered value of [my measure]
        ISFILTERED ( Dates[Year] )
            && ISFILTERED ( Dates[Month] )
            && ISFILTERED ( Dates[Day] ),
        [my measure],
        CALCULATE (
            [my measure],
            FILTER ( VALUES ( Dates[Week] ), Dates[Week] = WEEKNUM ( TODAY () ) )
        )
    )
    

2 Replies

  • Hi yellowold5 

    Assuming that the week is based on the WEEKNUM function, you can use ISFILTERED to check whether a filter is applied directly to a column. Note: returns true if a filter is appleid directly to the column specified in the argument, not when it is crossfiltered.

    =
    IF (
        --Filters must be directly applied to these three column in order to return the filtered value of [my measure]
        ISFILTERED ( Dates[Year] )
            && ISFILTERED ( Dates[Month] )
            && ISFILTERED ( Dates[Day] ),
        [my measure],
        CALCULATE (
            [my measure],
            FILTER ( VALUES ( Dates[Week] ), Dates[Week] = WEEKNUM ( TODAY () ) )
        )
    )