Forum Discussion

pavithra_viki's avatar
pavithra_viki
New Member
2 years ago
Solved

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 ...
  • Anonymous's avatar
    Anonymous
    2 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 Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.