Hi,
I have this conditional statement but the output is not correct for the ones that are on time...what could cause this?
the Below is data with that cond statement in my workflow that all have output showing as not met but they are MET?!
IF [Deadline Date] > [Completed Date] THEN "not met" ELSE "MET" ENDIF
Submitted Date | Deadline Date |
8/31/2022 3:20 PM | 9/1/2022 2:00 PM |
8/31/2022 12:16 PM | 9/1/2022 8:30 AM |
8/24/2022 10:38 AM | 8/25/2022 2:00 PM |
8/23/2022 11:42 AM | 8/24/2022 1:00 PM |
8/23/2022 2:29 PM | 8/24/2022 11:00 AM |
8/22/2022 12:07 PM | 8/22/2022 3:30 PM |
thanks,
Veronica
Is Completed Date in your formula the same as Submitted Date? And are you wanting to compare the full timestamp (date and time) or just the date?
On the workflow they both are Vstring and Yes I Want the full time stamp (Date & Time)
@VeronicaElse why should they all be met? According to your logic, they should only be 'Not met' if the Deadline comes after Completed date (which I'm guessing is the Submitted Date column in the example data you've given), which isn't the case for any of the rows.
I changed a couple of the Submitted Dates to come later than the Deadline and it works as expected. though you should first parse the two fields into their correct formats for comparison as below:
My guess, without knowing your exact requirement, is that you ought to switch your outcomes so:
IF [Deadline Date] > [Completed Date] THEN "MET" ELSE "Not met" ENDIF
Hey @VeronicaElse,
To compare these text dates you will need to convert them to a datetime data type. You can find some good quick videos on how data types work here on the community https://community.alteryx.com/t5/Interactive-Lessons/Understanding-Data-Types/ta-p/73958
I used the datetimeparse function to convert them. there is a great cheat sheet Blog here to learn more: https://community.alteryx.com/t5/Engine-Works/DateTime-Functions-Cheat-Sheet/ba-p/844353
Any questions or issues please ask
Ira Watt
Technical Consultant
Watt@Bulien.com
@VeronicaElse , Here is the workflow you need to first convert the values from AM/PM to 24-Hr format and then check the condition. Please accept my solution if it give you desired result.
Thanks! It worked to transfer to the data to 24hr format but they all show MET but there are a few that should not be met? I have attached the data dates/times. Also, what should I add to it to also show up as NOT MET for if the deadline column is blank?
thanks
Also, why did you se the regrex replace?
I am still learning and just curious on why it was needed.
thanks