Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

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