Alteryx Designer Desktop Discussions

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

Date Comparisons

Brian32
8 - Asteroid

Good Afternoon -

 

Been stuck on this for a while now.  Any guidance would be greatly appreciated and may save me from going bald in the next 12 hours!

 

I created an IF Statement that looks at a Date Column compares it to DateTimeToday() and then results in a V-String, returning 1 of 3 different values.

 

          IF [ProjectStatus]="Re Hold" THEN "RE HOLD"
          ELSEIF [ProjectStatus]="Site/REC Approved" && [Construction_Start]<DateTimeToday() && [Store_Open]>DateTimeToday() THEN "NS"
          ELSEIF [ProjectStatus]="Site/REC Approved" && [Construction_Start]<DateTimeToday() && [Store_Open]>DateTimeToday() THEN "CIP"
          ELSEIF [ProjectStatus]="Site/REC Approved" && [Construction_Start]<DateTimeToday() && [Store_Open]<DateTimeToday() THEN "OPEN"
          ELSE "" ENDIF


Currently the Database brings the dates in with the same format as Alteryx (yyyy-mm-dd) as a V_W String.

 

When I run the script I do not get the results I would expect using the logic above.  So I have done a number of things to play around with it and received various results, none of which worked though.

          DateTimeFormat([dt],"%m-%d-%y) for both my dates

          Created a new column called Today.  Formated to match the formating directly above and replaced DateTimeToday() in my IF Statement with [Today]

          Changed my data type for all my dates to Date

          Then I have done various combinations of these

 

Thank you in advance for your time and help.

 

 

12 REPLIES 12
Joe_Mako
12 - Quasar

No worries, data types can be tricky, and sometimes it is difficult to keep track of what field is what.

 

After your above formula expression that compares the Date data type values, you can change them to strings with the DateTimeFormat function to get he display that you want.

Brian32
8 - Asteroid

I think I am missing something here too then cause this nulls me out again.

 

DateTimeFormat.PNG

JessicaS
Alteryx Alumni (Retired)

Hi @Brian32,

 

 

It sounds like you may need further support on your questions.  If this is the case please email into support@alteryx.com and we will be happy to assist you.

 

Thanks,

Jess Silveri
Manager, Technical Account Management | Alteryx
Labels