cancel
Showing results for 
Search instead for 
Did you mean: 
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

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

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

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

View solution in original post

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 🙂

Proud to be a Super User!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.