Forum Discussion
Anonymous
6 years agoNot applicable
Previous month calculation
Hi, I'm looking to add a measure to a filter on to my table. I need to get the data to display the previous month and up to 10th of the next. E.g. if my report runs on the 1st April I ne...
az38
6 years agoCommunity Champion
Hi Anonymous
try like
Measure =
var _startDate = DATEADD(SELECTEDVALUE(Table[Date]), -2, MONTH)
var _startPeriod = STARTOFMONTH(_startDate)
var _endDate = DATEADD(SELECTEDVALUE(Table[Date]), -1, MONTH)
var _endPeriod = STARTOFMONTH(_endDate) + 9
RETURN
CALCULATE(SUM(Table[Value]), DATESBETWEEN(Table[Date], _startPeriod, _endPeriod) )- Anonymous6 years agoNot applicable
Hi az38 ,
Its currently coming up with paramter is not the correct type for my dates on row 1 and 3, even though theyre both formatted as dates?
It says selected value has been used in a true/false expression.
Regarding the Return part at the end of the query, this measure is ideally going to filter out rows of a table visual if its in this rolling date range. Would it still have a sum value included?
Thanks so much for your help with this.
Liam
- az386 years agoCommunity Champion
Anonymous
Measure = var _startDate = DATEADD(MAX(Table[Date]), -2, MONTH) var _startPeriod = STARTOFMONTH(_startDate) var _endDate = DATEADD(MAX(Table[Date]), -1, MONTH) var _endPeriod = STARTOFMONTH(_endDate) + 9 RETURN CALCULATE(SUM(Table[Value]), DATESBETWEEN(Table[Date], _startPeriod, _endPeriod) )- Anonymous6 years agoNot applicable