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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Patv
Helper II
Helper II

create calculated column to get Max date from different columns from same table

HI Friends, 

I have an easy task to solve but can't able to do it.  I have a table with ID, col1, col2, col3 and I want to create a calucated column  ( not measure)  that gets max date of col1, col2, col3. I can achive the expected result by creating measure using below formula but as I said I want to create a column. I used Max funciton but it doesn't work. Could you please help me figure it out? Thank you in advance!

 

MaxDate =
MAXX(
{
MAX(table[Col1]),
MAX(table[Col2]),
MAX(table[Col3])
},
[Value]
)

 

Pic12.png

 

3 REPLIES 3
Anonymous
Not applicable

HI @Patv,

AFAIK, power bi has limited the calculated column Dax functions usage when you are working with 'direct query' mode. So I think you need to use measure expression instead.

Regards,

Xiaoxin Sheng

VahidDM
Super User
Super User

Hi @Patv 

 

Try this code to find the MAX date and create a calculated column:

Max Date = max(MAX('Table'[Col1],'Table'[Col2]),'Table'[Col3])

 

Output:

VahidDM_1-1649377471616.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Hi VahidDM,

Thank you for replying. This solution works if I have a Storage Mode = "Import". Currenlty, I have a Storage Mode = DirectQuery and when I apply below formula, I get an error ORA-00932: inconsistent Datatypes: expected DATE got NUMBER. The exception was raised by the IDbCommand Intercace. ( attached sceen below).  In  my table, All the date columns have datatype = Date and ID has datatype = Number.  Would you please help me how to solve it?

Max Date = max(MAX('Table'[Col1],'Table'[Col2]),'Table'[Col3])

 

Pic13.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors
Top Kudoed Authors