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.
解決済み

How would I add months to a date using formula?

wonsun
アトム

Hello, 

So I'm having trouble adding different months to a certain date. 

One column is a date, and the other column is when the duration of the offer 

Date                     Offer exp.

2019-05-03          36 month

2018-03-27          12 month

2018-11-22          31 month

 

I'm trying to add an extra column using formula and think I should use a datetimeadd

but I'm having trouble filling in the formula. How should I do this?  Help would be appreciated.  Thanks 

6件の返信6
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @wonsun,

 

You could use a text to columns to split your expiry details and use the DateTimeAdd() function:

 

Jonathan-Sherman_0-1594284538232.png

 

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

ArtApa
Alteryx
Alteryx

DateTimeAdd (<date/time>, <interval>, "months"Return the given date/time extended by the given duration.  The <interval> specified the amount of time to be added, and <units> the date/time units to add.  The units are years, months, days, hours, minutes, or seconds (only one can be used), and the interval can be either positive or negative.

wwatson
クエーサー

wwatson_0-1594287719297.png

wwatson_1-1594287790741.png

 

Regards

 

grazitti_sapna
キャスター

Hi @wonsun,

 

Here is another approach using only one formula tool. I hope it helps

             

                      datetimeadd.png

Sapna Gupta
wonsun
アトム

Thank you so much! This helped a lot 🙂

spsanu
アトム

Thanks for this very helpful, Just wondering would it be possible to exclude last month , for example start date is Jan21 and month is 12 then as per this formula it would go till next Jan22, however, I would like to stop at Dec21 only, if I put -1 would that work or need to calculate the days differences as well.

 

Thanks,

Satya

ラベル
トップのソリューション投稿者