Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Dynamic date filter to be implement as on yesterday

Hi, I have requirement to be shown in report whenever the report is opened in service it has to show yesterday's mtd,then they can search from there . 3 different slicers i,m using for year,m...
  • v-jingzhang's avatar
    5 years ago

    Hi Anonymous 

     

    You can create a MTD measure like below. When a specific date is selected with the slicers, calculate the MTD of that date, otherwise calculate yesterday's MTD. 

    MTD = 
    VAR _yesterday = TODAY()-1
    VAR _endDate = SELECTEDVALUE(DimDate[Date],_yesterday)
    VAR _startOfMonth = EOMONTH(_endDate,-1)+1
    RETURN
    CALCULATE(SUM('Table'[Value]),DATESBETWEEN(DimDate[Date],_startOfMonth,_endDate))

     

    Before you publish the report, ensure the slicers don't select a date. After publishing the report to service, enter the report's settings pane and turn on the option Don't allow end users to save filters on this report under Persistent filters. Save the settings. Take note that this setting is working on the whole report.

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.