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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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))
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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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