Forum Discussion
Slicers
- 1 year ago
I am not able to understand by your description what second filter will represent just a number of days or something else.
would you please try this method I hope this would help you to create your custome date range filter.
https://www.youtube.com/watch?v=JLupF1j49wo
I hope I answered your question!
Try this
Create the “Month” Slicer:
Add a new slicer for the “Month” field.
Create a Supporting Table:
Create a table that includes all the combinations of Year, Half Year, Quarter, and Month. This table will help in dynamically filtering the data based on the selection in the “Year Toggle” slicer.
Create Measures for Dynamic Filtering:
Create measures to dynamically filter the “Month” slicer based on the selection in the “Year Toggle” slicer. Here are some example measures:
SelectedYearToggle = SELECTEDVALUE('Year Toggle'[Year Toggle])
MaxMonth =
CALCULATE(
MAX('Date'[Month]),
FILTER(
'Date',
'Date'[Year] = MAX('Date'[Year])
)
)
MaxHalfYear =
CALCULATE(
MAX('Date'[Month]),
FILTER(
'Date',
'Date'[Half Year] = MAX('Date'[Half Year])
)
)
MaxQuarter =
CALCULATE(
MAX('Date'[Month]),
FILTER(
'Date',
'Date'[Quarter] = MAX('Date'[Quarter])
)
)
MaxMonthOverall = MAX('Date'[Month])
Use the Measures in the “Month” Slicer:
Use the measures created above to dynamically filter the “Month” slicer. You can use a SWITCH statement to apply the correct measure based on the selection in the “Year Toggle” slicer.
DynamicMonthFilter =
SWITCH(
TRUE(),
[SelectedYearToggle] = "Year", [MaxMonth],
[SelectedYearToggle] = "Half Year", [MaxHalfYear],
[SelectedYearToggle] = "Quarter", [MaxQuarter],
[SelectedYearToggle] = "Month", [MaxMonthOverall]
)
Apply the Dynamic Filter:
Apply the DynamicMonthFilter measure to the “Month” slicer to ensure it updates based on the selection in the “Year Toggle” slicer.
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!