Forum Discussion
create single dropdown with thisWeek, thisMonth, thisYear and date slicer based on the selection.
i want to creata a dropdown slicer with values "wEEK, Month, Year, custom" as shown in the image below :
Consider this is FilterA
And another slicer with date :
Consider this is FilterB
Case :
If i select "Month" from filterA, then automatically in filterB should display current month dates i.e.,, froom 1-Aug-2024 to 31-Aug-2024.
Likewise, If i select "Week" from filterA, then automatically in filterB should display current month dates i.e.,, froom 4-Aug-2024 to 10-Aug-2024.
Likewise, If i select "Year" from filterA, then automatically in filterB should display current year dates i.e.,, froom 1-Jan-2024 to 31-Dec-2024.
*** Important ****
Likewise, If i select "Custom" from filterA, then automatically in filterB should display all the dates from the date table in the database.
Kindly help me in solving this.
- Anonymous2 years ago
Hi pavithra_viki ,
I agree with lbendlin's reply. As far as I know, Power BI doesn't support us to achieve this in between type slicer.
Sometimes we will try to add a measure into visual level filter to filter visual dynamicly with an unrelated slicer.
Here is my sample.
Measure = IF(ISFILTERED('Table'[Selection]), SWITCH( MAX('Table'[Selection]), "Week",IF(MAX('Calendar'[WeekStart]) = TODAY()-WEEKDAY(TODAY(),1)+1,1,0), "Month",IF(MAX('Calendar'[Year])*100+MAX('Calendar'[Month]) = YEAR(TODAY())*100+MONTH(TODAY()),1,0), "Year",IF(MAX('Calendar'[Year]) = YEAR(TODAY()),1,0), "Custom",1),0)Add this measure into visual level filter and set it to show items when value = 1.
We can see that it could work in list or drop type slicer, and wouldn't work in between type slicer.
Here I suggest you to try Relative Date function in this slicer.
in this week:
in this month:
in this year:
Custom = remove all filters to show all data.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- lbendlin
Super User
Is that something your users have actually asked for? Why not use the Filter Pane instead which gives you all that, and more.
- pavithra_vikiNew Member
its a client need
- AnonymousNot applicable
Hi pavithra_viki ,
I agree with lbendlin's reply. As far as I know, Power BI doesn't support us to achieve this in between type slicer.
Sometimes we will try to add a measure into visual level filter to filter visual dynamicly with an unrelated slicer.
Here is my sample.
Measure = IF(ISFILTERED('Table'[Selection]), SWITCH( MAX('Table'[Selection]), "Week",IF(MAX('Calendar'[WeekStart]) = TODAY()-WEEKDAY(TODAY(),1)+1,1,0), "Month",IF(MAX('Calendar'[Year])*100+MAX('Calendar'[Month]) = YEAR(TODAY())*100+MONTH(TODAY()),1,0), "Year",IF(MAX('Calendar'[Year]) = YEAR(TODAY()),1,0), "Custom",1),0)Add this measure into visual level filter and set it to show items when value = 1.
We can see that it could work in list or drop type slicer, and wouldn't work in between type slicer.
Here I suggest you to try Relative Date function in this slicer.
in this week:
in this month:
in this year:
Custom = remove all filters to show all data.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- pavithra_vikiNew Member
Thanks for the idea.
Can you help me by sharing your pbix. Would you like to go throw the methods and I could implement ?