Forum Discussion

jcastr02's avatar
jcastr02
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

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 hel...
  • Jakinta's avatar
    5 years ago
    = 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.