In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Using Dates in Formulas

tlewis
7 - Meteor

I do not understand why the formula result below is "No" (i.e. false). Both dates in the criteria are "2014-07-14" so I would expect the formula result to be "Yes" (i.e. true.)

 

If [TermDate] >= DateTimeAdd([TermDate], 2014 - DateTimeYear([TermDate]), "years")
Then "Yes"
Else "No"
Endif

1 REPLY 1
Thableaus
17 - Castor
17 - Castor

Hi  @tlewis 

 

Try this:

 

If ToDate([TermDate]) >= ToDate(DateTimeAdd([TermDate], 2014 - DateTimeYear([TermDate]), "years"))
Then "Yes"
Else "No"
Endif

When comparing dates with DateTime formulas, you have to be sure they are Dates and not in DateTime format.
Otherwise, you can get unexpected results.

Cheers, 
Labels
Top Solution Authors