We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Conditional Statement

VeronicaElse
8 - Asteroid

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 DateDeadline Date
8/31/2022 3:20 PM9/1/2022 2:00 PM
8/31/2022 12:16 PM9/1/2022 8:30 AM
8/24/2022 10:38 AM8/25/2022 2:00 PM
8/23/2022 11:42 AM8/24/2022 1:00 PM
8/23/2022 2:29 PM8/24/2022 11:00 AM
8/22/2022 12:07 PM8/22/2022 3:30 PM

 

thanks,

Veronica

9 REPLIES 9
Robin_McIntosh
11 - Bolide

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?

 

VeronicaElse
8 - Asteroid

On the workflow they both are Vstring and Yes I Want the full time stamp (Date & Time)

DataNath
17 - Castor
17 - Castor

@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:

 

DataNath_0-1662742916913.png

 

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

IraWatt
17 - Castor
17 - Castor

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

 

IraWatt_0-1662742344354.png

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 

 

 

 

 

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@IraWatt ,

 

Great example!

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
grazitti_sapna
17 - Castor

@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.

Sapna Gupta
VeronicaElse
8 - Asteroid

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

VeronicaElse
8 - Asteroid

attached

VeronicaElse
8 - Asteroid

Also, why did you se the regrex replace? 

 

I am still learning and just curious on why it was needed.

 

thanks

Labels
Top Solution Authors