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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jcastr02
Post Prodigy
Post Prodigy

Power query if formula

Can you help with a formula that would do the following in power query:

 

1. If the "Term Date" is blank then  (Today()-HireDate)  

 

If not blank

 

2.  TermDate-HireDate

 

Appreciate any help

1 ACCEPTED SOLUTION
Jakinta
Solution Sage
Solution Sage

= Table.AddColumn(PreviousStepName, "Days", each if [TermDate]=null then Duration.Days(Date.From(DateTime.LocalNow())-[HireDate]) else Duration.Days([TermDate]-[HireDate]), Int64.Type)

It is assumed that [TermDate] & [HireDate] columns are of type date.

View solution in original post

1 REPLY 1
Jakinta
Solution Sage
Solution Sage

= Table.AddColumn(PreviousStepName, "Days", each if [TermDate]=null then Duration.Days(Date.From(DateTime.LocalNow())-[HireDate]) else Duration.Days([TermDate]-[HireDate]), Int64.Type)

It is assumed that [TermDate] & [HireDate] columns are of type date.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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