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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
EmilyM2019
Helper II
Helper II

Picking a date from 2 columns

Hello all,

 

This might be really simple but I am getting super confused / frustrated so any help would be appreciated.

 

I have 2 date columns.

 

What I am trying to do is to have a 3rd column that looks in column 1, if it is blank then it looks in column 2 and pulls the date from there. If column 1 is not blank then it pulls the date from there.

 

I'm thinking it's a simple IF statement but I just can't seem to get it right.

 

Many thank.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@EmilyM2019 , Not sure U i got it.

Create a new date column

Date new =coalesce([date1],[date2])

join this with Date of Date table

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@EmilyM2019 , Not sure U i got it.

Create a new date column

Date new =coalesce([date1],[date2])

join this with Date of Date table

Thanks, first time i've used COALESCE. Helpful tip.

@amitchandak this solution worked for this problem, but now I have a slightly different scenario.

 

I now have 2 columns with different dates and I want a new column that picks the date closest to todays date.

 

Example below. What formula do I need to calculate column C?

 

EmilyM2019_0-1598346556071.png

 

Regards,

 

Emily.

Stachu
Community Champion
Community Champion

Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

Column1 Column2
A 1
B 2.5

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors