Why is my date comparison not working?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I am having trouble comparing dates in alteryx.
Why are my comparison logic not working properly?
These are in string format. But when I convert to "DATE" format they show as Null.
Solved! Go to Solution.
- Labels:
- Custom Tools
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
First one in the list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Amilley thanks, is there a way to do this in a mass way? I have many date fields lol
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Use a multi-field formula tool with
datetimeparse([_CurrentField_],'%d-%b-%y')
