rolling values
1 TopicCalculate rolling values in DAX (Tabular Model)
Dear all, I have to create 3 measure in Tabular model. 1) SUM of values of the last 12 monthes with end date the MAX selected date 2) SUM of values starting from -12 monthes to -24 monthes 3) SUM of values starting from -24 monthes to -36 monthes The first formula orks fine, this is the code: Last 12 Month Rolling:= VAR NumOfMonths = 12 VAR LastCurrentDate = MAX ( 'Posting Date'[Date] ) Return CALCULATE([day], DATESINPERIOD ( 'Posting Date'[Date], LastCurrentDate, - NumOfMonths, MONTH )) In the second formula I would have to replace LastCurrentDate with DATEADD (LastCurrentDate, -1, YEAR) I tried with this one: 12-24 Month Rolling:= VAR NumOfMonths = 12 //VAR LastCurrentDate = MAX ( 'Posting Date'[Date] ) Return CALCULATE([day], DATESINPERIOD ( 'Posting Date'[Date], DATEADD( MAX ( 'Posting Date'[Date] ),-1,YEAR), - NumOfMonths, MONTH )) But I got a semantic error on DATEADD function. Can you help me to solve the problem? Thank you, SimonaSolved626Views0likes2Comments