Forum Discussion
Slicer Help
- 7 months ago
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 🙂
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" )