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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
JPSingh
Frequent Visitor

How to get the next date from another column using IF / OR statement

I am trying to build a formula which basically tells me what the next date. e.g the one highlighted below what I want is to show the date from engage to lost as this was the next date. I need to do this for each stage so for Diagnose it needs to show me which stage date it went into next and the same for Engage, prescribe and etc. I have tried to do this in Power Query but the formula looks right however, I need it to read or so example below. The next engage date should show if prescribe is blank then select propose date, if propose date is blank then conclusion, if that is blank then lost date.

JPSingh_0-1725363733013.png

This is the formula I used in power query but because I don't have or it just picks up the prescribe date if engage is blank but if prescribe is blank it doesn't pick up propose. Is this possible to do?

 

= Table.AddColumn(#"Expanded Lost (Createddate)", "Diagnose Date to Next Step Date", each if [Engage Created Date] = null then [Prescribe Created Date] else if [Prescribe Created Date] = null then [Propose Created Date] else if [Propose Created Date] = null then [Conclusion Created Date] else if [Conclusion Created Date] = null then [#"Won (Createddate).Created Date"] else if [Conclusion Created Date] = null then [#"Lost (Createddate).Created Date"] else null)

 

 

1 ACCEPTED SOLUTION
JPSingh
Frequent Visitor

Thank you. This works works and is exactly what I needed. Thanks alot

View solution in original post

2 REPLIES 2
JPSingh
Frequent Visitor

Thank you. This works works and is exactly what I needed. Thanks alot

bhanu_gautam
Super User
Super User

@JPSingh , Try using updated formula

 

m
= Table.AddColumn(#"Expanded Lost (Createddate)", "Diagnose Date to Next Step Date", each
if [Engage Created Date] <> null then [Engage Created Date]
else if [Prescribe Created Date] <> null then [Prescribe Created Date]
else if [Propose Created Date] <> null then [Propose Created Date]
else if [Conclusion Created Date] <> null then [Conclusion Created Date]
else if [#"Won (Createddate).Created Date"] <> null then [#"Won (Createddate).Created Date"]
else if [#"Lost (Createddate).Created Date"] <> null then [#"Lost (Createddate).Created Date"]
else null)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors