Forum Discussion

RJC87's avatar
RJC87
New Member
6 months ago
Solved

Slicer Help

Hi,

 

New to the forums so hope this is the right place for this but wanted some advice to see if this is do able or if Im just chasing ghosts. I have a report that is based on monthly data, I have an in month dax that automatically selects the previous month, on my slicer I have each month in this financial year however I want the user to be able to click off the current month but the current month be a stand out colour to the rest of the slicer if the user clicks off it is there some conditional formatting I can use that will for instance show Dec 2025 as green (Current month report) when the user has Nov 2025 selected so at a glance they know the current report month isnt selected.

 

Kind regards

RJC

  • Hi RJC87 ,

    Please see the below screenshot, if I understand correctly, you just need the current month to highlighted irrispective of what month the user selects, in the below, the user has selected Mar-26 but the current month is Jan-26.

    To achieve this I have used the folllowing DAX:
    _Current Month Highlight =
    VAR CurrentMonth =
    FORMAT ( TODAY (), "MMM-YY" )
    VAR SelectedMonth =
    SELECTEDVALUE ( _Date[Month Year] )
    RETURN
    IF ( SelectedMonth = CurrentMonth, 1, 0 )

    Using the Button Slicer visual, I have changed the Callout>Background conditional format to use this DAX where the value = 1. You will need to amend the table and column names to look at the apropriate table, you will also need to change the formatting to "MMM YYYY" (based on your snippet).

    If your definition of "current month" is not 'today' then you can also use EOMONTH() to adjust it +/- X number of months appropriate to your definition.

    Hope this helps, please consider marking it as a sollution and providing a thumbs up as it helps others find this solution. Thanks 🙂

8 Replies

  • Create a measure:

    Current Month Label =
    "Current report month: " &
    FORMAT ( EOMONTH ( TODAY(), -1 ), "MMM yyyy" )

     

    Then:

    • Show it in a Card or Text box

    • Use conditional formatting (green background / icon)

    This gives users an immediate visual cue, even if they deselect it in the slicer.

  • Hi,

    I am not sure how your semantic model looks like, but I treid to create a sample pbix file like below.

    Please check the below picture and the attached pbix file. 

    What I tried is to have disconnected slicer table.

     

     

     

     

     

     

    Sales total: = 
    VAR _slicerlist =
        VALUES ( 'Slicer-Calendar'[Year-Month sort] )
    VAR _descriptionlist =
        SUMMARIZE (
            ADDCOLUMNS (
                _slicerlist,
                "@description", EOMONTH ( 'Slicer-Calendar'[Year-Month sort], -1 )
            ),
            [@description]
        )
    RETURN
        CALCULATE (
            SUM ( sales[sales] ),
            TREATAS ( _descriptionlist, 'Calendar'[Year-Month sort] )
        )

     

    Sales total color condition: = 
    VAR _currentmonth =
        EOMONTH ( TODAY (), 0 )
    VAR _priormonth =
        EOMONTH ( _currentmonth, -1 )
    VAR _slicerlist =
        VALUES ( 'Slicer-Calendar'[Year-Month sort] )
    VAR _condition =
        NOT (
            COUNTROWS ( _slicerlist ) = 1
                && MAXX ( _slicerlist, 'Slicer-Calendar'[Year-Month sort] ) = _currentmonth
        )
    RETURN
        IF ( _condition && MAX ( 'Calendar'[Year-Month sort] ) = _priormonth, "Green" )

     

  • I am not aware of your datasets, so i created a sample files but i am  not allowed to attached the PBIX file @Natalie_iTalent (FYI)

    Please create two measures.and create month key column, based on that you apply conditional formatting, please let me know if this works for RJC87 and accept this as a solution for others to easily found that in future, thanks
     

    Current Month Label =

     var current_month_key =

    YEAR ( TODAY() ) * 100 + MONTH ( TODAY() )

    RETURN

    current_month_key
    Highlight Current Month =

    VAR SelectedMonth =

        SELECTEDVALUE ( 'Current Month Highlighted Data'[Month Key] )

    RETURN

    IF (

        SelectedMonth = [Current Month Label],

        1,

        0

    )

     

    • RJC87's avatar
      RJC87
      New Member

      Thanks all for the replies however none of these are the solution to my issue, the bit I want highlighting is in the image below currently in the slicer I have Nov 2025 selected, the current reporting month is Dec 2025 so I want that to be highlighted a stand out colour so that people can see at a flash they arent looking at the current reporting month.

       

       

       

      • AWD's avatar
        AWD
        New Member

        Hi RJC87 ,

        Please see the below screenshot, if I understand correctly, you just need the current month to highlighted irrispective of what month the user selects, in the below, the user has selected Mar-26 but the current month is Jan-26.

        To achieve this I have used the folllowing DAX:
        _Current Month Highlight =
        VAR CurrentMonth =
        FORMAT ( TODAY (), "MMM-YY" )
        VAR SelectedMonth =
        SELECTEDVALUE ( _Date[Month Year] )
        RETURN
        IF ( SelectedMonth = CurrentMonth, 1, 0 )

        Using the Button Slicer visual, I have changed the Callout>Background conditional format to use this DAX where the value = 1. You will need to amend the table and column names to look at the apropriate table, you will also need to change the formatting to "MMM YYYY" (based on your snippet).

        If your definition of "current month" is not 'today' then you can also use EOMONTH() to adjust it +/- X number of months appropriate to your definition.

        Hope this helps, please consider marking it as a sollution and providing a thumbs up as it helps others find this solution. Thanks 🙂