Free Trial

Alteryx Designer Desktop Discussions

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

Create a new column based on a date range

EscapedGoat
5 - Atom

I want to have a column with 1 or 0 depending on if a date based on another column falls within a certain range. How would I write the formula. I tried the following but I know it's not right as its not reading the dates as dates. [Consent Date] is in DateTime format.

 

IF([Consent Date]) > 2020-12-31 AND < 2021-05-01 THEN 1 ELSE 0 ENDIF

4 REPLIES 4
apathetichell
19 - Altair

Dates have to be in quotes.

 

 

IF([Consent Date]) > "2020-12-31" AND < "2021-05-01" THEN 1 ELSE 0 ENDIF

 

This assumes [Consent Date] is an Alteryx Date. If not - try date/time first. or post how your date is set up and I'll edit the above with a solution specific to your current date formatting.

TheOC
15 - Aurora
15 - Aurora

Hey @EscapedGoat 

Cool name btw!

I've attached a workflow that does this, you were so close with the formula!

i used:
IIF([Consent Date] > "2020-12-31" AND [Consent Date] < "2021-05-01", 1,2)

Hope this helps!
TheOC


Bulien
EscapedGoat
5 - Atom

 Thank you! This worked 😊

TheOC
15 - Aurora
15 - Aurora

Not a problem!

Glad I could help,
Happy Alteryxing!

TheOC


Bulien
Labels
Top Solution Authors