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
wickenss
Regular Visitor

Default Start and End values in Date Slicers

I would like the ability to set the start and end ranges of a date slicer to select from a formula or query, I can't see any way to do this currently.

 

I do not believe that I can use the Page Level filters because I want the Slicer to suggest a range only and for the user to be able to change it if they want.

 

for example: The user, when accessing the report, will see the last complete month selected for them. TODAY() = 3/3/2017 Slicer range should default to 1st Feb 2017 to 28th Feb 2017 but if the user wants to view a different range then they can change it themselves, to any other date range.

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @wickenss,

 

>>I would like the ability to set the start and end ranges of a date slicer to select from a formula or query, I can't see any way to do this currently.

You can simple use allselected and lastdate/firstdata to get the selected range, then write a measure to calculate on it.

 

Calculate on Dateslicer=
var SelectMinDate=FIRSTDATE(ALLSELECTED(Table[Date]))
var SelectMaxDate=LASTDATE(ALLSELECTED(Table[Date]))
return
SUMX(FILTER(ALL(Table),[Date]>=SelectMinDate&&[Date]<=SelectMaxDate),[Value])

 

BTW, current date slicer not support setting default value.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @wickenss,

 

>>I would like the ability to set the start and end ranges of a date slicer to select from a formula or query, I can't see any way to do this currently.

You can simple use allselected and lastdate/firstdata to get the selected range, then write a measure to calculate on it.

 

Calculate on Dateslicer=
var SelectMinDate=FIRSTDATE(ALLSELECTED(Table[Date]))
var SelectMaxDate=LASTDATE(ALLSELECTED(Table[Date]))
return
SUMX(FILTER(ALL(Table),[Date]>=SelectMinDate&&[Date]<=SelectMaxDate),[Value])

 

BTW, current date slicer not support setting default value.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.