Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start 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
20 - Arcturus

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
16 - Nebula
16 - Nebula

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

Cheers,
TheOC
Connect with me:
LinkedIn Bulien
EscapedGoat
5 - Atom

 Thank you! This worked 😊

TheOC
16 - Nebula
16 - Nebula

Not a problem!

Glad I could help,
Happy Alteryxing!

TheOC

Cheers,
TheOC
Connect with me:
LinkedIn Bulien
Labels
Top Solution Authors