Skip to Content

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

Display three prior months starting from current month

Hello All,

I came across the requiremnt:

The report looks like:

2014-Jan2014-Feb2014-Mar2014-Apr2014-May2014-June2014-July2014-Aug2014-Sep2014-oct2014-Nov2014-Dec
A122233233233233233233233233233233233
B223333333333333333333333
C333333333333333333333333
D33333333333333333333333333333333333333333333333

The requirement is to display the prior 3 months ,current month, next 3 months.

Assume that current month is SEPTEMBER, the report should look like:

2014-June2014-July2014-Aug2014-Sep2014-oct2014-Nov2014-Dec
A233233233233233233233
B33333333333333
C33333333333333
D3333333333333333333333333333

Share your thoughts.

Thanks

Former Member
Former Member replied

Hello All,

I got this resolved using the below formula to get either prior 3 months or the next 3 months from current date:

3rd month from current date:

=LastDayOfMonth(RelativeDate(LastDayOfMonth(RelativeDate(LastDayOfMonth(RelativeDate(LastDayOfMonth(CurrentDate()); 1));1));1))

Prior 3rd month from current date:

=ToDate(FormatDate(RelativeDate(ToDate(FormatDate(RelativeDate(ToDate(FormatDate(RelativeDate(ToDate(FormatDate(CurrentDate();"MM/yyyy");"MM/yyyy");-1);"MM/yyyy");"MM/yyyy");-1);"MM/yyyy");"MM/yyyy");-1);"MM/yyyy");"MM/yyyy")

and used these objects to restrict my date field(date object between "Prior 3rd month from current date:" and

"Prior 3rd month from current date:"

Thanks,

Vijay

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