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 August 31st. Request your voucher.

Reply
JamesGordon
Helper II
Helper II

IF Column with dates

Hi,

 

I am trying to create a column that will return the date from two columns if one is blank.

 

The two columns are Trans Date and Sett Date. Trans Date always has a date however i would like to use Sett Date unless it is Blank?

 

I have tried to create a column using this Dax

Sett Date V2 = IF(Sheet1[SETT_DATE] > Sheet1[TRANS_DATE], Sheet1[SETT_DATE], Sheet1[TRANS_DATE])
 
However i get this error "DAX comparison operations do not support comparing values of type Text with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values."
 
Here is a screenshot of the data with the desired outcome in the red box:
Can anyone suggest a DAX that may work?
Power Bi ques 19.jpg
 
 
1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

Hi. The error seems to be about one of those columns. Check their data type because one of them might be type text and the other date. Make sure they are both date (change them in the edit queries / transform data menu). You can read more about this here:

https://docs.microsoft.com/en-us/power-bi/desktop-data-types

After having the same data types your dax should work. However you mention you want to ask about blank, so you should try this:

 

NewColumn = 
IF(
    ISBLANK(Table[SETT_DATE]),
    Table[TRANS_DATE],
    Table[SETT_DATE]
)

 

Hope this helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

2 REPLIES 2
ibarrau
Super User
Super User

Hi. The error seems to be about one of those columns. Check their data type because one of them might be type text and the other date. Make sure they are both date (change them in the edit queries / transform data menu). You can read more about this here:

https://docs.microsoft.com/en-us/power-bi/desktop-data-types

After having the same data types your dax should work. However you mention you want to ask about blank, so you should try this:

 

NewColumn = 
IF(
    ISBLANK(Table[SETT_DATE]),
    Table[TRANS_DATE],
    Table[SETT_DATE]
)

 

Hope this helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Thanks @ibarrau you were correct. One of the columns wasnt set as a date in the data type!

once i changed that my Dax worked!

 

Thanks!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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