cancel
Showing results for 
Search instead for 
Did you mean: 

Display three prior months starting from current month

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

nikhil_joy2
Active Contributor
0 Kudos

Hi Vijaya,

I assume that you are connected through BICS connectivity. You can create a key figure structure in bex query which will contain 7 restricted key figures  restricted by the month variable with offset.

for eg:- if ZMONTH is the variable selected by the user, your restricted key figures will be restricted based on the selected month. Sales where month=ZMONTH, ZMONTH-1,ZMONTH-2,ZMONT-3,ZMONTH+1,ZMONTH+2,ZMONTH+3. so total 7 restricted keyfigures will be there and you can have text variable to dynamically display the month and year name for each one.

If there is no selection, and always refer to current month, you can have an exit variable which always takes current month instead of ZMONTH.

Regards,

Nikhil Joy