Alteryx Designer Desktop Discussions

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

Why is my date comparison not working?

wonka1234
10 - Fireball

Hi,

 

I am having trouble comparing dates in alteryx.

 

Why are my comparison logic not working properly?

 

wonka1234_0-1678409440168.png

 

 

These are in string format. But when I convert to "DATE" format they show as Null.

5 REPLIES 5
Amilley
8 - Asteroid

The issue here is you are actually doing string comparison Vs data comparison. If you then simply use a select tool in order to do type conversion, the challenge there is that the fields are not in the ISO standard date format - the solution? Use the DateTime tool in the parse category to convert to a true date field and then run your comparison

 

Amilley
8 - Asteroid

Amilley_1-1678409936769.png

First one in the list

Luke_C
17 - Castor

Hi @wonka1234 \

 

@Amilley is spot on. Alteryx only supports yyyy-mm-dd format for datetime operations. Here's a formula that would work using the DateTimeParse function:

 

Read more about working with dates here: DateTime Functions | Alteryx Help

if datetimeparse([Delivery],'%d-%b-%y') > datetimeparse([Planned],'%d-%b-%y')
then 'Fail'
else 'Pass'
endif

Luke_C_0-1678410135418.png

 

wonka1234
10 - Fireball

@Amilley  thanks, is there a way to do this in a mass way? I have many date fields lol

Luke_C
17 - Castor

Use a multi-field formula tool with 

datetimeparse([_CurrentField_],'%d-%b-%y')

Luke_C_0-1678410818783.png

 

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels