Alteryx Designer Desktop Discussions

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

Creating a new date-variable based on another date-variable

aleksi555
6 - Meteoroid

Hey, Is there a way to make a new date variable based on another date variable? I have dates like 1/1/2010 and 5/5/2012 and I would like to get a new variable which has certain amount of time added to those date values. For example, I want 6 months to be added to those values. So I need to get 1/7/2010 and 5/11/2012. In excel I could simply add 180 to those date values. 

 

Below is the same example as above. So I would like to solve date2 by using date1.

 

date1          date2

1/1/2010    1/7/2010

5/5/2012    5/11/2012

 

Thanks!

2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus

Here are two functions for your review:

  1. DateTimeAdd(dt,i,u)
  2. DateTimeDiff(dt1,dt2,u)

I could add 180 days to your date2 field by use of this formula:

DateTimeAdd([Date2],180,"days")

I could calculate the difference between date1 and date2 (in terms of days) and use that result as the i (increment) and add that same number of days to date2.

 

Does this help?

 

P.S.  The format for a date in Alteryx is:  YYYY-MM-DD

 

Thanks,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
aleksi555
6 - Meteoroid
Great. Thanks!
Labels