Hi,
I am trying to combine the smart functionalities of having a predefined Period Table, as @Melissa has made with a Custom Date Range selection from BI Elite
Link to Melissa’s Period Table: (dynamic date range slicer query m code
Link To BI Elites video: Custom Date Period Selections in Power BI
I added a ‘Custom date’ option to the period table (giving me all dates for the latest 3 years):
{"Custom date", Date.From(Date.AddYears(Date.StartOfYear(TodaysDate), -3)), TodaysDate, 17}
I then added a ‘Date slicer’ to be used when “Custom date” is selected:
As shown in BI Elites video, I filtered the ‘Date Slicer’ using this DAX code, and then set it =1 on the slicer:
Date Slicer Filter =
IF(
SELECTEDVALUE('Period table'[Period]) = "Custom date",
1,
0
)
The problem occurs If you choose your custom date range to be anything from the minimum, and then go and select another period from the Periods table, then the dates inside the Date Slicer will stay unchanged.
The steps i made:
-
Select custom date
-
change date in date slicer:
-
Select another Period:
As you can see, It filters the data correctly, but it keeps the date I selected from the custom date. It is a bit confusing for the users that the ‘Date slicer’ is still showing the previously selected date range.
Is there is a way for the “Date Slicer” to reset when a period is selected?
See example here: custom date selection and date period.pbix (872.6 KB)