In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
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