Comparing dates in filter tool
- 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
Hello,
My input data looks like this:
Data Date Last Location Date
2024-03-29T13:11:21Z 2024-03-29 20:32:29
The above is just 1 row of many, where I need to find rows where Last Location is prior (less than) Data Data.
Here is the expression I used in filter tool:
[Last Known Location Last Reported Time] < [DataDate]
It runs, no errors. but the example row above is out on 'T' anchor. this is suppose to be records that match the expression. But for the two dates above, Last Location Date is same day, but later time.
Is my expression valid to compare two date/time values? if not, how can I compare date/time? ty!!
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@youngjw without being able to see how that Last Location Date field is being populated, it appears to look correct. I would caution that each row's Last Location Date is aligned to the time specification you are looking for. If there are groups of records that have the same Last Location Date time value, that would be helpful on the data validation front.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@youngjw
This "2024-03-29T13:11:21Z " is not looking like a data format.
So we need to change it to date Time format first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you, Qui!
The 'z' at end of time stamp indicates that the time zone is UTC. this data is imported from an xlsx file and in excel at least, that field is defined as date / time.
At any rate, I am trying your suggestion, but get the following error:
ErrorLink: Formula (23): https://community.alteryx.com/t5/*/*/ta-p/710269?utm_source=designer&utm_medium=resultsgrid|The field "" is missing. Compare the tool configuration with the input stream.
I have this in the expression:
Replace(Replace([DataDate], "T", " "), "Z","")
Am I missing anything obvious? thanks agian!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
FWIW,
The issue appeared to be around the time stamps and as Qui pointed out, maybe Alteryx did not like the ending Z, denoting UTC time zone.
Time wasn't critical for my comparison
I resolved this by using the DateTime parser and just converted that UTC date / time stirng to a Date that Alteryx then could compare.
