Forum Discussion
Recent Date Slicer
Hello,
How to create a year and month slicer in Power BI Desktop so that it always displays the most recent year and month in the fact table and the slicer automatically updates to the latest month when the fact table data is updated. Note that it is not the “latest year and month” 4 characters, but the actual year and month in the date table (e.g. March 2025).
Please do not use third-party visualization
ths.!
It is not what you think. You will be selecting the latest month and year in the slicer but the offset column will be used to store the filter and this is to be done in Tabular Editor. Of course, persistent filters, if enabled will override the choice. Please refer to this article https://owenaugerbi.com/exploring-slicer-default-selections/
3 Replies
- danextianSuper User
Hi 一棵黄葛树
In Tabular Editor, you need to to leverage 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. Further reading is in the video description - https://www.youtube.com/watch?v=MrEAZREQuXM&ab_channel=DAXJutsu
- 一棵黄葛树Helper II
Thanks for the attention!
Your solution is to create a new column in the date table and compare the year and month with the year and month where the most recent date in the fact table is located, if the same it is 0, otherwise 1. Then put the new column in the filter of the year and month slicer and select 0. But such will not automatically render the most recent year and month of the fact table, and will have to be hand-selected again.
Unfortunately, I can't watch youtube videos here. Can you help make an attachment to upload it? Thanks!- danextianSuper User
It is not what you think. You will be selecting the latest month and year in the slicer but the offset column will be used to store the filter and this is to be done in Tabular Editor. Of course, persistent filters, if enabled will override the choice. Please refer to this article https://owenaugerbi.com/exploring-slicer-default-selections/