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
Mahi1827
Resolver I
Resolver I

How to show dynamic date range by default and how to reset default date range after report refresh

Hi,

I have a date slicer using currdate column in slicer from date table. as per need need to show date slicer as by default  date range with start date as "current year first date" and end date as "todays date".

 

so i am using below measure and applied on date slicer visual filter as 1. i have tried with both measure and calculated column by using below logic but its not working as expected.


Daterange =
VAR currDate =CALCULATE(MIN('DATE'[currDate]),all('DATE'[currDate]))
VAR minidate= (DATE(YEAR(TODAY()),1,1))
VAR enddate = today()
RETURN
IF ( (currDate)>=minidate && (currDate)<=enddate,1,0 )


when i am trying with above meaure not able to show date range as start is current year first date and end date as todays date in date slicer.


also as  per  need,  if i select any other dates and trying to refresh report i am not able to re set the default date range as start is current year first date and end date as todays date.

 

Please suggest with updated dax/solution or any other approaches.

Thanks in advance for your time and help..


Thanks,
Mahi1827

1 ACCEPTED SOLUTION

Hi amitchandak,

The updated dax logic is working fine as expected. Thank you so much for your time and suggestions.

 

Thanks,

Mahi1827

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Mahi1827 , You will not be able to default range .

You can have a column like this in date table and use it (Filter on YTD)

Is Today = if('Date'[Date]<=TODAY() && year('Date'[Date]) = year(TODAY()),"YTD",[Date]&"")

 

 

Use relative date slicer : https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

Hi amitchandak,

The updated dax logic is working fine as expected. Thank you so much for your time and suggestions.

 

Thanks,

Mahi1827

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.