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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

The MAX function in DAX only accepts a column reference as an argument

Hi All,

I am new to DAX. Below is my code:

var maxdate = MAX((DATEADD(DimDate[Date], -1 , month)))

From research, DATEADD returns A table containing a single column of date values.

 

However, I get the following error when I try to save the measure "The MAX function only accepts a column reference as an argument."  What is the name of the column in the table return by DATEADD so I can reference it?

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Anonymous 

Instead of MAX try it with LASTDATE, should give you what you are looking for.

VAR maxdate = LASTDATE ( DATEADD ( DimDate[Date],-1, MONTH ) )

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks @amitchandak and @jdbuchanan71  for your help Smiley Happy

amitchandak
Super User
Super User

The above solution or you can try

 maxx('DimDate',DATEDIFF('DimDate'[Date],-1,MONTH))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
jdbuchanan71
Super User
Super User

Hello @Anonymous 

Instead of MAX try it with LASTDATE, should give you what you are looking for.

VAR maxdate = LASTDATE ( DATEADD ( DimDate[Date],-1, MONTH ) )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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