Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Paulyeo11
Impactful Individual
Impactful Individual

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 :-
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Paulyeo11 , try like

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Paulyeo11 , try like

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

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.

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.