The Alteryx Community is a finalist in three 2026 CMX Awards! Help us win Customer Support Community, Most Engaged Community, and User Group Program of the Year - vote now! (it only takes about 2 minutes) before January 9.
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
解決済み

Create a new column based on a date range

EscapedGoat
アトム

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件の返信4
apathetichell
アルクトゥルス

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
アトム

 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
ラベル
トップのソリューション投稿者