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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Mike282
Helper III
Helper III

I want my date dimension slicer to only be selectable for the current year and 1 year in the past

I have a facts table with forecast data and dates (as it's forecast, the dates may go into the future). I then join these dates to a date dimension table so that I can add a date range slicer in. 

 

Is it possible to have the date range slicer to only have date ranges for this year and 1 year from the past. So for example I'm posting this on the 11th of July 2024. The date range slicer range should only be selectable from the 1st of Jan 2023 to 31st of December 2024.

 

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Mike282 , For this create one filtered date table

 

FilteredDateTable =
VAR CurrentYear = YEAR(TODAY())
VAR PreviousYear = CurrentYear - 1
RETURN
FILTER(
'DateDimension',
'DateDimension'[Date] >= DATE(PreviousYear, 1, 1) &&
'DateDimension'[Date] <= DATE(CurrentYear, 12, 31)
)

 

Ensure that the relationships between the new FilteredDateTable and your facts table are correctly set up.
Replace the original date dimension table with the FilteredDateTable in your visuals.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

3 REPLIES 3
Mike282
Helper III
Helper III

Thank you! Why didn't I think of just creating a date dimension table through DAX doh! Thanks for the help!!

cath1ynn
Resolver II
Resolver II

Without knowing how your visuals are set up in your report page, this reply is only specific to your date slicer.

 

Yes, you can have the date range slicer to only have date ranges for this year and 1 year in the past. The simpliest way is to just apply a filter on the slicer visual

 

Without filter

cath1ynn_0-1720677319400.png

 

With filter

cath1ynn_2-1720677338973.png

 

My issue with this is that the available options for filtering relative dates here is pretty limited. Notice how selecting "is in the last 1 years" set the date range to exactly one year ago rather than include the full calendar year?

 

If you want to include the full calendar year, you could create a new calc column that determine if the date is within the current + last calendar year and include that as a filter for your slicer visual.

 

IsCurrLastYr = 
    VAR _today = TODAY()
    VAR _cy = YEAR(_today)
    VAR _ydate = YEAR(GLOBAL_DATE_DIMENSION[DATE])

    RETURN IF(_ydate >= _cy - 1 && _ydate <= _cy, 1, 0)

 

cath1ynn_3-1720677672048.png

 

bhanu_gautam
Super User
Super User

@Mike282 , For this create one filtered date table

 

FilteredDateTable =
VAR CurrentYear = YEAR(TODAY())
VAR PreviousYear = CurrentYear - 1
RETURN
FILTER(
'DateDimension',
'DateDimension'[Date] >= DATE(PreviousYear, 1, 1) &&
'DateDimension'[Date] <= DATE(CurrentYear, 12, 31)
)

 

Ensure that the relationships between the new FilteredDateTable and your facts table are correctly set up.
Replace the original date dimension table with the FilteredDateTable in your visuals.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.