Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask 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