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

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

Reply
dolevh
Helper II
Helper II

DAX Column - use another value if field is blank

Hi all, 

I have a 'Customer' Table: 

 

ID   Date1   Date2
1   1/1/2021 
2   1/2/2021 
3    1/3/2021
4    1/4/2021 
5   1/5/2021   1/5/2021

 

I need a dax that unit the column Date 1 with Date 2 just if Date2 is empty. 

For example: 

 

ID   Date1   Date2   NewColumn
1   1/1/2021    1/1/2021
2   1/2/2021    1/2/2021
3    1/3/2021   1/3/2021
4    1/4/2021    1/4/2021 
5    1/5/2021    1/5/2021   1/5/2021

 

Thanks All.

1 ACCEPTED SOLUTION

If they're both from the same table, then there shouldn't be any problem writing a calculated column on that same table as I suggested and I don't know why you say you can't find them.

 

Of course, if you're defining a measure, then you need to use an aggregation function since there isn't any row context like there is in a calculated column. For example,

Measure1 = COALESCE ( MAX ( Customer[Date1] ), MAX ( Customer[Date2] ) )

View solution in original post

7 REPLIES 7
AlexisOlson
Super User
Super User

This seems like a good situation for COALESCE:

COALESCE ( Customer[Date1], Customer[Date2] )

 

With COALESCE function I can't find the columns 'Date1' and 'Date2' in my table. 
Do you know why? @AlexisOlson  
Thank you!

I was assuming that those were your columns on your table and suggesting how to define a new calculated column. If they aren't in your table, then you'll need to explain where they are since you haven't shared your file.

I took the columns from two different tables but I created one table with all these columns in power query (after merging between tables).

I don't follow.

 

Replace the column references I gave with whatever column or value they should be. If they're measures, then remove both 'Customer' table references from what I gave and it should work as a measure. If they aren't columns from the same table or measures, then you need to provide more information.

This is two columns from the same table, tell me which information do you need please.

Thank you!

If they're both from the same table, then there shouldn't be any problem writing a calculated column on that same table as I suggested and I don't know why you say you can't find them.

 

Of course, if you're defining a measure, then you need to use an aggregation function since there isn't any row context like there is in a calculated column. For example,

Measure1 = COALESCE ( MAX ( Customer[Date1] ), MAX ( Customer[Date2] ) )

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.