Forum Discussion

Koritala's avatar
Koritala
Post Patron
1 year ago
Solved

User defined Custom Periods Slicer

Hi,

I have a requirement of filtering the tabular data visual default for Month to date. Also, when user select custom, it should show the date range slicer for seleting the start and end dates.

In Slicer, we should have 2 values. one for MTD, second custom. Default slicer should select for MTD and report should show records from first of current month to the today. date range slicer should render only when user select Custom option in slicer.

Can anyone share the .pbi file for the same.

Regards,

Sri

6 Replies

  • Hi Koritala ,

     

    Conditionally hiding report elements on slicer selection is not supported in Power BI. You will need to use Bookmarks to implement this. So basically, you will need two bookmarks:

    1. MTD Bookmark: This will have a relative date filter in the filter pane set to Last 1 Month and will have the DateRange Slicer hidden.

    2. Custom Date Filter Bookmark: This will have the relative date filter in the Filters pane cleared and will have the visibility of DateRange Slicer turned on.

    Then map these bookmarks to respective buttons.

     


    Hope it helps!

  • Hi Koritala 

     

    Could you please try below steps:

    • Create a Period Selector table with two values: MTD and Custom.
    • Add this table as a slicer in the report.
    • Write a measure that checks the slicer value:
      • If MTD << filter data from the 1st of the current month to today.
      • If Custom << return 1 so that the normal Date slicer applies.
    • Use this measure as a visual filter (value = 1).
    • Result: report defaults to MTD but switches to custom date range when the user selects Custom.

  • v-aatheeque's avatar
    v-aatheeque
    Community Support

    Hi Koritala 

    Just cross check that the above approach was already shared earlier for setting up the slicer with MTD as default and enabling the date range slicer only when Custom is selected. Were you able to implement this solution in your report?

    If so, did it meet your requirement, or do you still need further assistance?         

          

    • v-aatheeque's avatar
      v-aatheeque
      Community Support

      Hi Koritala 

      Just wanted to confirm if the approach we shared earlier  setting up the slicer with Month-to-Date as the default and showing the date range slicer only when Custom is selected  worked for you.

      Were you able to implement this in your report? If so, did it meet your needs, or would you like further assistance?

      • v-aatheeque's avatar
        v-aatheeque
        Community Support

        Hi Koritala 

        We haven’t heard from you on the last response and was just checking back to see if your query was answered,

        Otherwise, will respond back with the more details and we will try to help .

         

        If we don’t hear back, we may close this thread in line with our community guidelines, but you’re always welcome to post a new query anytime.

        Thank you for being part of the Microsoft Fabric Community!