Forum Discussion
Year updated automatically
- 6 months ago
Slicers remember their last state. When 2026 is added to the model, Power BI will add it to the list, but it will not auto-select it. So instead of using Year column in your slicer, create a new column that contains value "This Year" instead 2026(I mean current year here). Then use that field in your slicer. E.g. slicer would be:
2023
2024
2025
This Year
- Calculated column in your Date table:
Year Label = IF ( 'Date'[Year] = YEAR ( TODAY() ), "This Year", FORMAT ( 'Date'[Year], "0000" ) )-
Select Year Label
-
Set Sort by column → Year
- 6 months ago
Hi majid154a
A common solution and as what others have already suggested is to substitute the current year with another text like this year but if you want to keep the value as-is is to 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. I have a tutorial on this on YouTube - https://youtu.be/iSQ9n1z9gYA
I would suggest to create a column in the calendar
Current Year =
VAR _CurrentYear
YEAR ( TODAY () ) ---- or YEAR ( MAX (Sales[Date] ) ), depending on how you want to define the current year
VAR _CurrentRowDateYear = YEAR ( Calendar [Date] )
RETURN
IF ( _CurrentYear = _CurrentRowDateYear, "Y", "N" )
Use that column in the drop down slicer selecting the value Y
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI