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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Restrict Date Range outside the given dates in Date Slicer

Hi Team,

 

we have requirement where we need to show date slicer which will have dates starting from 01-January of current year till today. So as of now, it should show only dates from 01-Jan-2019 to 15-Nov-2019. For this, we have created Calender table in Power BI that has below formula in Power Query to select range from current year till today.

 

= {Number.From(#date(Date.Year(DateTime.LocalNow()), 1, 1))..Number.From(#date(Date.Year(DateTime.LocalNow()), Date.Month(DateTime.LocalNow()), Date.Day(DateTime.LocalNow())))}

= Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

= Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}})

 

However, when we bind it to date slicer, user can still select dates beyond the given range. I.e User can select dates prior to 2019 as well as dates beyond today.  Please see below screenshot.

 

We need to restrict user dynamicaly as per current year. So if when we enter Year 2020, user shouldn't be able to select any date range prior to 01-Jan-2020.

 

 

Please suggest how can we restrict user not to select dates beyond given ranges.

0 REPLIES 0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors