Forum Discussion
Dynamic preselected selection in PowerBI slicer
I am working on automation of a task which contains monthly data. I want my slicer to be automatically select the latest month data available whenever the data refreshes
Hi IshaDahra
As you can see i have created a calculated column
In which i have named for current month to show Latest Month ( in calculated col)
and in the slicer i just selected Latest Month, Now whenever the new month data is added then that calculated column is re-run when it get refresh then again Latest Month will give the current month which is added into it .
I have just tried with a sample by adding next month for 1999. and it's working
If this answers your questions kindly accept it as a solution and give kudos.
14 Replies
- ArulSuper User
- IshaDahraRegular Visitor
It's Month names
- IshaDahraRegular Visitor
It's month's names
- ArulSuper User
IshaDahra ,
There is no direct way to select the latest month always in the slicer upon data refresh but we have workaround.Create a new calculated column based on the existing date column which will contains monthyear format as you mentioned for other months and "Current month" text for latest month. This will update as on when data is refreshed. Use this newly created calculated column in the slicer.
Please refer the file attached.
- wardy912Super User
Hi IshaDahra
Ensure your month column is sorted by a number column.
Add your slicer and make sure it's sorted by the month column descending.
Enable single select.
If you want to dynamically filter your page every time, just add the month column to the filter pane.
Select 'relative date', 'is in this month'
I hope this helps, please give a thumbs up and mark as solved if it does, thanks!
- mdaatifraza5556Super User
Hi IshaDahra
Can you please try the below steps to get your result ?This is based on the max date you have in your table ( either it is max date as per you data or it is related to today)
1. Create a calculated column in your date table using below dax
MonthLabel =VAR CurrentMonth =EOMONTH('date'[Date], 0)VAR LatestMonth =CALCULATE(MAXX(ALL('date'), EOMONTH('date'[Date], 0)),REMOVEFILTERS('date'))RETURNIF(CurrentMonth = LatestMonth,"Latest Month",FORMAT('date'[Date], "MMM-YYYY"))Now add a slicer ( use MonthLabel column) and select the Latest Month and then published it to the workspace.
whenever the use open the report it is always Latest Month is selected, later or you can change the month or by the help of year slicer you can also adjust this.
ResultIf this answers your questions, kindly accept it as a solution and give kudos.
- IshaDahraRegular Visitor
I have put Month name's name in slicer, if the latest month data in slicer is July-2025 and I publish it. Then, the data of August is loaded in folder to automatically refresh the dashboard, the selection of slicer doesn't changes to August
- IshaDahraRegular Visitor
From this, if next month's data is updated the previous month's data from slicer is not getting removed
- mdaatifraza5556Super User
Hi IshaDahra
Can you please share the snapshot of the slicer how you want
you want to show only current month name in the slicer or something else
In my approch it will always select the current month having in your datasetIf this answers your questions, kindly accept it as a solution and give kudos.