Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

How to add/subtract days and months to from another date.

wonka1234
10 - Fireball

Hi,

 

I want to incorporate the following logic into a new column

 

If [date] => "13th of the month of the [date] column" then [date] + 3months

 

if [date] < "13th of month of the [date] column" then [date] - 1 month\

 

[date] values look like so:

2021-11-03
2021-11-16

 

So with this said the new column should show:

 

2021-11-03       ->    2021-10-03 (-30 days or 1 month)
2021-11-16      ->    2022-02-16   (+90 days or 3 months)

 

 

Thanks,

Jonathan

2 REPLIES 2
AmalinaH
Alteryx
Alteryx

Hi @wonka1234 , you can utilise a formula like this:

 

AmalinaH_0-1655997375658.png

 

if DateTimeDay([Date])<13 then DateTimeAdd([Date],-1,"months")
else DateTimeAdd([Date],3,"months")
endif

 

Hope that helps!

Luke_C
17 - Castor

Hi @wonka1234 

 

Something like the below formula should work. I would note using days vs months in the datetimeadd function will yield different results based on how the formulas work. It looks like months gets you your expected results. 

Luke_C_0-1655997456225.png

 

 

 

Labels