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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MAkiva1
Helper I
Helper I

Combining 2 Date Fields into 1

I have 2 date fields in the same table in my database: Date Field 1 and Date Field 2.  Date Field 1 always contains data; Date FIeld 2 sometimes contains data.  What I'd like to do is create a new date column that always prefers Date Field 2 only if it has data, otherwise I want it to pull data from Date Field 1.  

 

Example 1: Date Field 1 has a date 03/16/2017; Date Field 2 is blank; New Column = 03/16/2017

Example 2: Date Field has a date 03/16/2017; Date Field 2 has a date 04/08/2017; New Column = 04/08/2017

 

I tried to use the SWITCH() function but wasn't able to get it to work.  Any suggestions?

1 ACCEPTED SOLUTION
drewlewis15
Solution Specialist
Solution Specialist

What about creating a custom column using the Query Editor?  You could add a column with the following statement (replace the text in green with your field names:

 

if [Date 2] <> null then [Date 2] else [Date 1]

 

It would result in something like this:

date.jpg

View solution in original post

5 REPLIES 5
drewlewis15
Solution Specialist
Solution Specialist

What about creating a custom column using the Query Editor?  You could add a column with the following statement (replace the text in green with your field names:

 

if [Date 2] <> null then [Date 2] else [Date 1]

 

It would result in something like this:

date.jpg

anandav
Skilled Sharer
Skilled Sharer

@MAkiva1,

 

Will the below DAX work for you?

New Date = IF(ISBLANK(Sheet1[Date 2]), Sheet1[Date 1], Sheet1[Date 2])

DatesExample.jpg

 

No, I get the following error:

 

"A single value for column '[Date Field]' in table '[Table]' cannot be determined.  This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."

 

Any other suggestions?

@MAkiva1, create it as a new column (not as a measure).

Hi - I tried creating it as a column instead of a measure and still received the same error.  Any other suggestions?  

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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