Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Last 3 month month year

Hi Experts,

       My dateformat of my field is MM.YYYY,

so in the prompt for end date i used formula

          userresponse("Enter last date:") as in prompt statement

Now i want the last 3 months date

e.g; last month =12.2014

then i want 11.2014,10.2014,09.2014



Former Member
Former Member replied

Hi Ashwin,

Please follow following steps:

Create variable Month

1. Month=   ToNumber(Substr(( userresponse("Enter last date:"));0;2))

**This will Give you Month Number.

2. Month-1 = If([Month] =1) Then 12 Else([Month]-1)

**This will give last month number

3. Month-2 = If([Month] =1) Then 11 ElseIf ([Month] =2) Then 12 Else ([Month]-2)

**This will give last to last month number

4. Month-3 = If([Month] =1) Then 10 ElseIf ([Month] =2) Then 11 ElseIf ([Month] =3) Then 12 Else ([Month]-3)

**This will give last to last to last month number

Similarly you can find year and later concatenate both.

Hope it helps!

Let me know if I dint get your requirement correct.


Sheetal Sharma

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question