Forum Discussion

Abhilash_P's avatar
Abhilash_P
Super User
2 years ago

Default slicer selection

How can i keep default dates selection as current month dates in slicer visual
Note - Start date should be 1st of the current month but end date has to be dates till the data is available in current month

 

1 Reply

  • Abhilash_P , Currently there is no configuration to do it directly 

     

    You can use a date table and create measure for Start and End dates

    StartOfMonth =
    DATE(YEAR(TODAY()), MONTH(TODAY()), 1)

    EndOfMonth =
    CALCULATE(
    MAX('YourDataTable'[DateColumn]),
    FILTER(
    'YourDataTable',
    YEAR('YourDataTable'[DateColumn]) = YEAR(TODAY()) &&
    MONTH('YourDataTable'[DateColumn]) = MONTH(TODAY())
    )
    )

     

    Then

    Create a Slicer: Add a slicer visual to your report and set it to use the date column from your date table.

    Set Default Values Using Bookmarks: To set the default values for the slicer, you can use bookmarks and the relative date filtering feature.

    First, set the slicer to the desired default range manually:
    Set the start date to the 1st of the current month.
    Set the end date to the latest available date in the current month.
    Create a bookmark with this slicer state:
    Go to the "View" tab and open the "Bookmarks" pane.
    Click "Add" to create a new bookmark and name it (e.g., "DefaultDateRange").
    Use the Bookmark on Report Load: To ensure the slicer defaults to the current month range when the report is loaded, you can use the bookmark created in the previous step.

    Go to the "View" tab and open the "Selection" pane.
    Select the slicer visual.
    In the "Bookmarks" pane, right-click the bookmark you created and select "Update".