Forum Discussion
undefined
I have a date column, in which new values get added frequently not daily. Example values given below
2025-04-07,
2025-04-05,
2025-04-02.
I want to create a slicer where by default select latest available date.
How can be done.
Note: In filters it can be done, but in slicer visual how to do it?
Hello Anonymous
You can use the dax for calculated column
LastDateLabel =
VAR LatestDate = CALCULATE(MAX('YourTable'[Date]), ALL('YourTable'))
RETURN
IF(
'YourTable'[Date] = LatestDate,
"Last Date",
RELATED('d_Calendario'[Date]) -- or FORMAT(RELATED(...), "yyyy-mm-dd") if you want a formatted text
)use this column to slicer keep last date selected in slicer
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
6 Replies
- bhanu_gautamSuper User
Anonymous Create a new measure to get the latest date:
LatestDate = MAX('YourTable'[DateColumn])
Create a new column to flag the latest date:
IsLatestDate = IF('YourTable'[DateColumn] = [LatestDate], 1, 0)
Add a slicer visual to your report.
Drag the DateColumn to the slicer.Click on the slicer visual to select it.
In the "Filters" pane, add the IsLatestDate column to the filters on this visual.
Set the filter to show only items where IsLatestDate is 1. - pankajnamekar25Super User
Hello Anonymous
You can use the dax for calculated column
LastDateLabel =
VAR LatestDate = CALCULATE(MAX('YourTable'[Date]), ALL('YourTable'))
RETURN
IF(
'YourTable'[Date] = LatestDate,
"Last Date",
RELATED('d_Calendario'[Date]) -- or FORMAT(RELATED(...), "yyyy-mm-dd") if you want a formatted text
)use this column to slicer keep last date selected in slicer
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
- danextianSuper User
Hi Anonymous
If you want the actual latest date to be selected by default—rather than using a label like "latest date"—you’ll need to use Tabular Editor. Specifically, you can use the *Group By Columns* property to store a filter based on an alternate value, which acts as the key for the entity. Power BI stores this key behind the scenes, allowing the visible filter value to update automatically.
For example, if May-24 is selected and has a key of 0, then when June arrives, June will take the key 0 and May will shift to 1. This causes the slicer to automatically reflect the most recent date without any manual change. If you're not comfortable using this method, you'll need to explore other alternatives provided.
Please refer to this video-https://www.youtube.com/watch?v=MrEAZREQuXM&ab_channel=DAXJutsu
- v-echaithraCommunity Support
Hi Anonymous ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Chaithra E. - v-echaithraCommunity Support
Hi Anonymous ,
We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Chaithra. - v-echaithraCommunity Support
Hi @Krishna2456 ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Chaithra E.