Forum Discussion
Need help with slicer's default selection
Hi All,
I need help with power bi report slicer to select the current month by default. As shown in the below screenshot, currently February 2025 is selected as it is the current month but I want slicer to select March 2025 when we enter into next month.
I don't have any date information in my fact table but I created custom period (1,2,3 etc) and built a dimensional table to tag each month with a period number. The report source is a data collection sheet and every month I change period tag with a new period number and I take back up of the previous month with old period tag and build history. I have two tables in the data model, one hold current month's data and another hold previous month's data.
There's many solutions out there about the default slicer selection but I couldn't find a way for slicer to select actual month without changing the month name. Any help will be appreciated. Thanks.
hI udas24
Using Tabular Editor, you can leverage the Group by Columns property to "store a filter by using an alternate value, which represents the key of the entity." Power BI uses this key to store the filter, allowing the corresponding filter value in the visual to change dynamically. For instance, if May-24 is selected in the visual and currently has a key of 0, when June arrives, May will shift to a key of 1, and June will take the key of 0. Consequently, the slicer selection will automatically change to June.
Demo: https://www.youtube.com/watch?v=MrEAZREQuXM
Further reading is on the video description.
- Anonymous1 year ago
Hi udas24 , hello danextian, thank you for your prompt reply!
Based on my research, you can use the certified custom visual Preselected Slicer to complete the task.
Follow these steps to create the necessary measures:
Current Period = VAR MaxPeriod = MAXX(ALL(PeriodTable),PeriodTable[Period]) RETURN MaxPeriodIsCurrentPeriod = IF(SELECTEDVALUE('PeriodTable'[Period]) = [Current Period], TRUE(), FALSE())Since the Preselected Slicer requires a Dirty Status field containing Boolean values, you need to create a dummy table.
Dummy = UNION ( SELECTCOLUMNS ( { TRUE }, "Dummy", TRUE ), SELECTCOLUMNS ( { FALSE }, "Dummy", FALSE ) )Result for your reference:
Hope the following article is helpful to you:
Exploring slicer default selections – Owen Auger's BI Blog
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- danextianSuper User
hI udas24
Using Tabular Editor, you can leverage the Group by Columns property to "store a filter by using an alternate value, which represents the key of the entity." Power BI uses this key to store the filter, allowing the corresponding filter value in the visual to change dynamically. For instance, if May-24 is selected in the visual and currently has a key of 0, when June arrives, May will shift to a key of 1, and June will take the key of 0. Consequently, the slicer selection will automatically change to June.
Demo: https://www.youtube.com/watch?v=MrEAZREQuXM
Further reading is on the video description.
- AnonymousNot applicable
Hi udas24 , hello danextian, thank you for your prompt reply!
Based on my research, you can use the certified custom visual Preselected Slicer to complete the task.
Follow these steps to create the necessary measures:
Current Period = VAR MaxPeriod = MAXX(ALL(PeriodTable),PeriodTable[Period]) RETURN MaxPeriodIsCurrentPeriod = IF(SELECTEDVALUE('PeriodTable'[Period]) = [Current Period], TRUE(), FALSE())Since the Preselected Slicer requires a Dirty Status field containing Boolean values, you need to create a dummy table.
Dummy = UNION ( SELECTCOLUMNS ( { TRUE }, "Dummy", TRUE ), SELECTCOLUMNS ( { FALSE }, "Dummy", FALSE ) )Result for your reference:
Hope the following article is helpful to you:
Exploring slicer default selections – Owen Auger's BI Blog
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- udas24Frequent Visitor
Hi, danextian thanks for your valuable input. Unfortunately I am not looking to work on Tabular Editor at the moment.
Hi Anonymous thank you for the suggestion. I previously came across this Preselected Slicer and wasn't successful in an attempt to make it work however this time after following your steps it worked.
Now, one issue I encounter with this slicer is that it can’t be visually changed to Tile format.
Any thoughts or comments on this?
Thanks.