cancel
Showing results for 
Search instead for 
Did you mean: 

ADD_MONTHS in Calculated Column

Former Member
0 Kudos

Hi everybody,

I want to create a date, which is 36 month before the date I use right now. To add months to a date I found a function called add_months. https://help.sap.com/saphelp_hanaone/helpdata/en/20/da7b237519101489f3e2e1a284355a/content.htm

I created a calculated column, but I cant use the expression within the editor because the function is not supported. Furthermore, I would need a sub_months function.

Any thoughts how to create a date like that in a calculation view?

Regards, Christoph.

Accepted Solutions (1)

Accepted Solutions (1)

former_member256353
Participant

Hi Christoph,

Why dont you just add negative months?

SELECT ADD_MONTHS (TO_DATE ('2009-12-05', 'YYYY-MM-DD'), -24) "add months" FROM DUMMY

Result will be: 5.12.2007

Like this you can add/subtract days, months, weeks, years.

Hope this will help you achieving your goal.

regards

Greg

Former Member
0 Kudos

Hi Greg,

thanks for the answer, great idea. My problem is that the function isnt supported in the expression editor (see screenshot attached). I need a workaround. Any thoughts?

Best regards

lbreddemann
Active Contributor
0 Kudos

Just use addmonths (<yourcolumn>, -36).

Works for me.

Former Member
0 Kudos

Thanks Lars - perfect!

Answers (0)