Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

If Statement with DateTimeToday Function

Sheena_dup_300
6 - Meteoroid

I am really new to Alteryx.

I am adding  new field to give me "Created Last 30 Days", "Created Last 60 Days", "Created Last 90 Days", "90+Days" in one column based of the create date.

I am receiving a "Malformed If Statement" error for my formula below:

 

 Capture.PNG

 

IF [OppCreateDate]=DateTimeToday()<=30
THEN "Created Last 30 Days"
ELSEIF [OppCreateDate]=DateTimeToday()<=60
THEN "Created Last 60 Days"
ELSEIF [OppCreateDate]=DateTimeToday()<=90
THEN "Created Last 90 Days"
ElseIF [OppCreateDate]=datetimetoday()>=90
THEN "90+ Days"
EndIF

 

What am I not seeing here?

1 REPLY 1
patrick_digan
17 - Castor
17 - Castor

@Sheena_dup_300 Welcome! I think 2 things need to change: 1) You should use the datetimediff function to compare dates. Something like 

DateTimeDiff(OppCreateDate,DateTimeToday,"days")<=30

 2) You'll need to have a final Else even if nothing could possibly go there. So after "90+ days" you could put Else "Unknown"

Labels
Top Solution Authors