Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Error msg " The MAX function only accepts a column reference as an argument. "

Hi All

 
I get below expression from Amit :-
_Roll 12_2_ = CALCULATE(sum(SALES[sales]),DATESINPERIOD('Date'[Date],max(dateadd(SALES[date],-12,month)),-12,MONTH))
 
I get error msg :-
  • Anonymous , try like

    Last 12 before 12  = CALCULATE(SUM(Sales[Net Sales]), DATESINPERIOD('Date'[Date], maxx('Date', DATEADD('Date'[Date],-12,MONTH)),-12, MONTH))

2 Replies

  • Anonymous , try like

    Last 12 before 12  = CALCULATE(SUM(Sales[Net Sales]), DATESINPERIOD('Date'[Date], maxx('Date', DATEADD('Date'[Date],-12,MONTH)),-12, MONTH))
    • saibhav's avatar
      saibhav
      New Member

      Hi Amit,

       

      This was my problem too but the error was gone when I used MAXX instead of MAX. But it is showing just blank rows without data. 

      I have used Rolling 3 for Previous year = CALCULATE([Volume],DATESINPERIOD('Date'[Date],maxx(dateadd('Date'[Date],-12,month)),-3,MONTH). Could you please help me in solving this?

      Also, when I tried for Rolling 3 for Current year = CALCULATE([Volume],DATESINPERIOD('Date'[Date],max('Date'[Date]),-3,MONTH)), it worked but its not working for same months previous year.