Forum Discussion
adiljamal
3 years agoFrequent Visitor
Custom Relative Month Filter
Hey Community, TLDR: Given monthly data of past few years, how can I create a relative month filter, where I have the option to filter data of last X month (where my reference month is not today...
amitchandak
3 years agoSuper User
adiljamal , do all calculation based on date
Like last 5 days, use your period variable
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = _max -5
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Last 12 months
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
you can use date as date add