Forum Discussion
Patv
Helper II
4 years agocreate 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...
VahidDM
Super User
4 years agoHi 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:
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/
Patv
Helper II
4 years agoHi 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])