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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
dabeans518
Frequent Visitor

Changing date range filter using a measure

Is it possible to change the value of a date range filter using a measure? 

I have this period filter that is in page1

dabeans518_0-1726477557075.png

it only affects visuals like table, cards, etc.
But I don't know if it's possible to change the value of a date range itself.

dabeans518_1-1726477613191.png

This date filter is in page2. Hopefully there's a workaround.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from lbendlin , please allow me to provide another insight:

Hi, @dabeans518 

You can try using slicer synchronization:

1.Firstly, modify the slicer on the page:

vlinyulumsft_0-1726553544124.png

2.Secondly, create the following measure:

MEASURE =
VAR cc1 =
    MAX ( 'Table'[Column1] )
RETURN
    SWITCH (
        TRUE (),
        cc1 = "YTD", IF ( YEAR ( MAX ( 'Table 2'[Date] ) ) = YEAR ( TODAY () ), 1, 0 ),
        cc1 = "MTD",
            IF (
                YEAR ( MAX ( 'Table 2'[Date] ) ) = YEAR ( TODAY () )
                    && MONTH ( MAX ( 'Table 2'[Date] ) ) = MONTH ( TODAY () ),
                1,
                0
            ),
        FALSE ()
    )

3.Apply the measure to the slicer:

vlinyulumsft_1-1726553593875.png

4.Here is the final result, which I hope meets your requirements:

vlinyulumsft_2-1726553593877.png

vlinyulumsft_3-1726553728798.png

It is recommended to change the slicer style to “tile,” as the current “between” style may cause issues.

For detailed information, please refer to:

Enable the Sync Slicers feature in Power BI visuals - Power BI | Microsoft Learn

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks for the reply from lbendlin , please allow me to provide another insight:

Hi, @dabeans518 

You can try using slicer synchronization:

1.Firstly, modify the slicer on the page:

vlinyulumsft_0-1726553544124.png

2.Secondly, create the following measure:

MEASURE =
VAR cc1 =
    MAX ( 'Table'[Column1] )
RETURN
    SWITCH (
        TRUE (),
        cc1 = "YTD", IF ( YEAR ( MAX ( 'Table 2'[Date] ) ) = YEAR ( TODAY () ), 1, 0 ),
        cc1 = "MTD",
            IF (
                YEAR ( MAX ( 'Table 2'[Date] ) ) = YEAR ( TODAY () )
                    && MONTH ( MAX ( 'Table 2'[Date] ) ) = MONTH ( TODAY () ),
                1,
                0
            ),
        FALSE ()
    )

3.Apply the measure to the slicer:

vlinyulumsft_1-1726553593875.png

4.Here is the final result, which I hope meets your requirements:

vlinyulumsft_2-1726553593877.png

vlinyulumsft_3-1726553728798.png

It is recommended to change the slicer style to “tile,” as the current “between” style may cause issues.

For detailed information, please refer to:

Enable the Sync Slicers feature in Power BI visuals - Power BI | Microsoft Learn

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

lbendlin
Super User
Super User

That would be a question for your data model. While you cannot programmatically set slicer boundaries the field that feeds the slicer can be impacted by external filters.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.