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 September 15. Request your voucher.

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
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.