Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Restrict the Data in Report

Hi all,

 

I have a Daily frequency Report which get Refreshed Daily. I want to restrict the Data to 30 days for user. for example-when user opens the report, he should see only data from current date to 30 days back. if user selects any other date (march24th), he should see data from March24th to april 24th. So, whatever Date he selects he should get data for 30 days from Date of selection.

 

Here he should also have feasibility to get Data for one day. i.e he should also be able to see data for single day(March 28, April 15,...)

 

Looking for solution asap.

 

TIA

1 Reply

  • Hey Anonymous ,

     

    what you want can be achieved by using a dedicated calendar table and measures.
    Here is an example how a measure may look like:

    Quantity last 30 dayy = 
    var _today = TODAY()
    var _todayDate = DATE(YEAR(_today) , MONTH(_today) , DAY(_today))
    var _offset = 30
    var _dateBackThen = _todayDate - _offset
    return
    CALCULATE(
        SUM('Fact Sale'[Quantity])
        , DATESBETWEEN('Dimension Date'[Date] , _dateBackThen , _todayDate)
    )
     

    This article contains almost everything that you can imagine how to answer time-related questions: https://www.daxpatterns.com/time-patterns/

     

    Hopefully, this gets you started.

     

    Regards,

    Tom