Forum Discussion

YogiK's avatar
YogiK
Frequent Visitor
7 years ago
Solved

Setting default date slicer to yesterday

Hi Everyone,    I am currntly working on making a date slicer defalt as yeaterday.  data should show from begin till yeartday's date.  and also allow user to choose any date they want. Is this pos...
  • marclelijveld's avatar
    7 years ago

    Hi YogiK

    You can use the relative date slicer in Power BI. Very simple :) In the example below I only use current year, but of course you can also use other timeframes. 
    1. Create a slicer with your date column. 
    2. At the right top of the slicer, choose Relative as slicertype. 
    3. Now you will have 3 items to fill in your slicer, set them like the following: | This | - | Year |
    4. Open the Format pane for your slicer and open the Date Range options. 
    5. Set the toggle for Include today to off. 

    If you publish your report with this filter applied, the default applied filter will be the current year, so that it all data since the beginning of this year, like Year to Date. But be warned, if you allow end-users to save filters to the report in the Power BI service, this may result in other applied filters then the the filters you want to apply by default. You can change this in Power BI desktop in: File > Options > Report settins > Persistent filters

    Users can change this period by selecting an other period, like last month or something else in the relative slicer. If you want give them the abbility to select a specific date, you can also add a second slicer or give users the ability to change the relative slicer to any other type of slicer them selves (see step 2 above). Users can change the filtertype themselves as long as you haven't disabled visuals headers. 

    Will this work for you? 

    - Marc