Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Tarun_B
Frequent Visitor

Slicer Not Defaulting to Latest Date in Power BI

I am trying to set a slicer in Power BI to automatically default to the latest date in my dataset. I have a column called load_date in my table. I want the slicer to always show the most recent date without needing to manually select it each time.

 

Steps Taken:

Created a measure to identify the latest date:
LatestDate = CALCULATE(MAX('table'[load_date]))
Created a calculated column to flag the latest date:
IsLatestDate = IF('table'[load_date] = [LatestDate], "Latest", "Historical")
Added a slicer using the load_date field.

 

Issue:

The slicer does not automatically pick the latest date after a data refresh.
Both the latest date and the previous day's date show up in the slicer.
I have to manually select the latest date in Power BI Desktop for the data and visuals to refresh correctly.
Example:

After a refresh, the slicer shows both 03-02-2025 and the previous day's date.
The visuals on the dashboard do not sync and show 0 values until I manually select the latest date.
Request:

Tarun_B_0-1738823383593.png

 

How can I configure the slicer to automatically select the latest date upon data refresh without manual intervention?
Please help 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Tarun_B 

 

Power BI retains a filter value based on the slicer selection. If you choose "Latest" instead of a specific date, the "Latest" option will continue to be selected when the dates change, unlike when you select the date itself.

 

Notice the difference when a category is selectead instead of a date:

danextian_0-1738826304289.png

For those willing to experiment, you can use the "Group by Columns" property to store a filter using an alternate value that represents the entity's key. Power BI uses this key to dynamically adjust the filter value in the visual. For example, if May-24 is selected and currently has a key of 0, when June arrives, May's key will shift to 1, and June will take the key of 0. As a result, the slicer selection will automatically update to June. This functionality can be achieved using an external tool called Tabular Editor. A demo and further reading are available in the video description. https://www.youtube.com/watch?v=MrEAZREQuXM&t=3s 

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from danextian , please allow me to add some more information:
Hi  @Tarun_B ,

You can try using the “Preselected Slicer” in the custom viusal.

For the slicer that comes with Power BI, we can not get it. But we can get the three point in the "Visualizations", and we click the "Get more visual":

vyangliumsft_0-1738913717489.png

First , we need to create a table with one column , and the value is True and False, like this:

vyangliumsft_1-1738913717490.png

Second , we can create a measure to define which the date we need to default preselected. If we need to default preselect then we return True else return False.

Flag =
VAR _date =
    SELECTEDVALUE ( 'Table'[Date] )
VAR _max_date =
    MAXX ( ALL ( 'Table' ), [Date] )
RETURN
    IF ( _date = _max_date, TRUE (), FALSE () )

Then we can put the 'Table'[Date] in the Fields , [Flag] in the Pre Selection , 'Dirty Table'[Dirty Status] in the Dirty Status, like below screenshot: 

vyangliumsft_2-1738913753605.png

We can then dynamically pre-select the last day by default in the slice visualization, and when we select another date, simply click the red reset button in the upper right corner to restore the default selection.

vyangliumsft_3-1738913753606.png

 

Best Regards,

Liu Yang

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

 

Tarun_B
Frequent Visitor

Let me try this today at 8 PM IST, once the data refreshes I will keep you posted.

danextian
Super User
Super User

Hi @Tarun_B 

 

Power BI retains a filter value based on the slicer selection. If you choose "Latest" instead of a specific date, the "Latest" option will continue to be selected when the dates change, unlike when you select the date itself.

 

Notice the difference when a category is selectead instead of a date:

danextian_0-1738826304289.png

For those willing to experiment, you can use the "Group by Columns" property to store a filter using an alternate value that represents the entity's key. Power BI uses this key to dynamically adjust the filter value in the visual. For example, if May-24 is selected and currently has a key of 0, when June arrives, May's key will shift to 1, and June will take the key of 0. As a result, the slicer selection will automatically update to June. This functionality can be achieved using an external tool called Tabular Editor. A demo and further reading are available in the video description. https://www.youtube.com/watch?v=MrEAZREQuXM&t=3s 

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.