Forum Discussion
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.
EmilyM2019 , Not sure U i got it.
Create a new date column
Date new =coalesce([date1],[date2])
join this with Date of Date table
4 Replies
- amitchandak
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
- EmilyM2019
Helper II
Thanks, first time i've used COALESCE. Helpful tip.
- EmilyM2019
Helper II
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?
Regards,
Emily.
- Stachu
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