- May 12, 2021
- Posted by: Siva Mani
- Category: Power BI
I got frequent ask from Biz users to keep the default date range in Power BI Dashboards e.g., last 3,6 months and it should dynamically change based on the current date. We can achieve this requirement with a relative slicer, but there is a limitation to select a custom date range.
It is not the end of the world????. This blog has a workaround to achieve such use cases in the following simple steps.
The below report used to demonstrate the workaround,
Let’s assume that we wanted to default the date slicer selection to the Last 3 completed months.
Step 1: Create a relative Slicer in addition to the Date Between slicer.
Step 2: Apply the required filter. In this case, the Last 3 completed months
Step 3: Hide the relative slicer and create a button/icon
Go to, Power BI Desktop ribbon -> View -> Selection
- Hide the slicer
- Create a button and align it on top of the existing slicer(UI: I enabled Background and set transparency 50%)
Step 4: Create bookmarks
Go to, Power BI Desktop ribbon -> View -> Bookmark
- Select Relative Slicer, Button, and Date slicer in the selection pane
- Create a bookmark with Selected Visual – Default Selection
- Hide button
- Clear relative slicer filter and hide it
- Create another bookmark – Clear Default Selection
Step 5: Create an icon or a button to configure the bookmarks
I used the button created earlier to configure Clear Default Selection.
Publish and check the Power BI Report,
Power BI has a lot of Power full features. At times, we need to combine multiple features to create what we need. With the above steps, Dynamic Default Date Selection is possible with one or two additional clicks. The same workaround can be used for the Last N Days/Weeks/Years. Please feel free to reach Cittabase for more information. Visit our blogs for more topics on Power BI.