Free Trial

Alteryx Designer Desktop Discussions

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

Comparing current date to static date then adding X days

dareinnyc
7 - Meteor

Hi all,

 

I need help coming up with a formula to:

1. Pull today's date (date only)

2. Compare it to the target hire date.

3. If today's date is within 30 days of the target hire date (i.e. Today's date - target hire date < 30)

4. Then add 30 days to the estimated hire date (new column called new target hire date)

 

My current formula is (wrong):

IF DateTimeNow()-[Target Hire Date]<30
THEN DateTimeAdd([Target Hire Date],30,"days")
ELSE [Target Hire Date]
ENDIF

3 REPLIES 3
PhilipMannering
16 - Nebula
16 - Nebula

Hey @dareinnyc 

if DateTimeDiff([DateTimeNow(), [Target Hire Date], 'days') < 30
then DateTimeAdd([Target Hire Date],30,"days")
else [Target Hire Date]
endif

Let me know if this works.

 

dareinnyc
7 - Meteor

Classification: Internal
Hi, this doesn't seem to work as it is still adding 30 days to all target hire dates after datetimenow. The logic should only add 30 days to the target hire date should the original target hire date be less than 30 days from datetimenow. Thanks

dareinnyc
7 - Meteor

Its ok, i switched the fields around and it works now. 

 

 

IF DateTimeDiff([Target Hire Date],DateTimeNow(), 'days')<30
THEN DateTimeAdd([Target Hire Date],60,"days") ELSE [Target Hire Date]
ENDIF

 

Labels
Top Solution Authors