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

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

Reply
erikm
Frequent Visitor

Set fixed date for date slicer

I am designing a report that contains a date slicer. Would it be possible to have the from-date automatically set, based on the to-date? For example, when the user selects 06/29/2021 as the end date, I would like to have 01/01/2020 automatically set as the start date, without the ability for the user to change that.

 

The logic would be, that the from-date is always January 1st of the year before the selected end-date.

 

Thank you!

2 REPLIES 2
Icey
Community Support
Community Support

Hi @erikm ,

 

Can this meet your requirements?

StartDate =
VAR SelectedDate_ =
    SELECTEDVALUE ( Dates[Date] )
VAR StartDate_ =
    DATE ( YEAR ( SelectedDate_ ) - 1, 1, 1 )
RETURN
    StartDate_
Measure = 
IF (
    MAX ( 'Data Table'[Date] ) >= [StartDate]
        && MAX ( 'Data Table'[Date] ) <= SELECTEDVALUE ( Dates[Date] ),
    1
)

startdate.gif

 

 

Best Regards,

Icey

 

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

Kumail
Post Prodigy
Post Prodigy

Hello @erikm 

 

You can do something like this

Measure as filter = 
VAR MonthsToLookBack = 10
VAR DataTableDate = MIN('Data Table'[Date])
VAR DateTableDate = MIN('Dates'[Date])
VAR DateAddAlternative = EDATE(DateTableDate,-MonthsToLookBack)
RETURN
    IF(
        (DataTableDate < DateTableDate)  && 
        (DataTableDate > DateAddAlternative)  ,
        -- FLAG IF TRUE --
        1
        )

If you could send sample .pbix that demonstrate what you are looking to get. It would really help providing you a quick implemented solution.

 

Hope this helps

 

Regards
Kumail Raza

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.