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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.