Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Current month default selection in Slicers

I have slicer  with showing Month name.How i can set current month name as default value while loading report?

Currently i created a column like this for default set up...

Current Month = IF(YEAR('table'[date])=YEAR(TODAY()) && MONTH('table'[date])=MONTH(TODAY()), 1, 0)
Added  Current Month as column in filter and select 1 as value in filter so that only show current month by default while loading report.Is there any other solution is there? And also i want to change selection month name as user requirement after loading the report.Any suggestion for this?
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    According to my understanding, you want to display the specific month based on the selected value in slicer,right?

    You coulf create a table by entering data for slicer like this:

    And then use SWITCH() function :

     

    Current Month =
    IF (
        YEAR ( MAX ( 'Table'[Date] ) ) = YEAR ( TODAY () )
            && MAX ( 'Table'[Month] ) = MONTH ( TODAY () ),
        1,
        0
    )
    Previous Month =
    IF (
        YEAR ( MAX ( 'Table'[Date] ) ) = YEAR ( TODAY () )
            && MAX ( 'Table'[Month] )
                = MONTH ( TODAY () ) - 1,
        1,
        0
    )

     

    ....

     

    =
    SWITCH (
        MAX ( 'ForSlicer'[Value] ),
        "Current Month", [Current Month],
        "Previous Month", [Previous Month],
        "Next Month", [Next Month]
    )

     

    After applying the [Measure] to filter pane ,and setting as "=1", the final output is shown below:

     

    Please take a look at the pbix file here.

     

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

2 Replies

  • Anonymous 

    Just change your calculated column a bit like so.

    Current Month =
    IF (
        YEAR ( 'table'[date] ) = YEAR ( TODAY () )
            && MONTH ( 'table'[date] ) = MONTH ( TODAY () ),
        "Current Month",
        FORMAT ( 'table'[date], "mmmm" )
    )

    This will give you a column you can use in your slicer where you can selecte "Current Month".  As the months change and the table is refreshed the rows marked as "Current Month" will shift.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    According to my understanding, you want to display the specific month based on the selected value in slicer,right?

    You coulf create a table by entering data for slicer like this:

    And then use SWITCH() function :

     

    Current Month =
    IF (
        YEAR ( MAX ( 'Table'[Date] ) ) = YEAR ( TODAY () )
            && MAX ( 'Table'[Month] ) = MONTH ( TODAY () ),
        1,
        0
    )
    Previous Month =
    IF (
        YEAR ( MAX ( 'Table'[Date] ) ) = YEAR ( TODAY () )
            && MAX ( 'Table'[Month] )
                = MONTH ( TODAY () ) - 1,
        1,
        0
    )

     

    ....

     

    =
    SWITCH (
        MAX ( 'ForSlicer'[Value] ),
        "Current Month", [Current Month],
        "Previous Month", [Previous Month],
        "Next Month", [Next Month]
    )

     

    After applying the [Measure] to filter pane ,and setting as "=1", the final output is shown below:

     

    Please take a look at the pbix file here.

     

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