Forum Discussion
Anonymous
6 years agoNot applicable
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 da...
TomMartens
Super User
6 years agoHey 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