cancel
Showing results for 
Search instead for 
Did you mean: 

How should decrease month from given calender year?

Former Member
0 Kudos

HI Experts,

How should decrease one month from given screen shot.

E.g  user input is: Feb 2012   we need  jan2012

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

Hi Mani,

is your issue resolved?

Former Member
0 Kudos

A bit of a mouthful but this will work:

=If(Left([Your Month];3)="JAN";"N/A";FormatDate(ToDate(FormatNumber((ToNumber(FormatDate(ToDate("01 "+[Your Month];"dd MMM yyyy");"yyyyMM"))-1)*100+1;"00000000");"yyyyMMdd");"MMM yyyy"))

Former Member
0 Kudos

Hi Mani,

IF user input is FEB2012 then you have to show JAN 2012 right?

UMonth=Userresponse("Enter value for Month") same text as you gave in your Prompt.

[Pmonth]=Previous([UMonth]) will give always previous value of entered month.

saurabh_sonawane
Active Contributor
0 Kudos

Hi

try this work around (with the help of prompt)

we have to make same 2 query in webi

one with prompt of cal month and other without prompt of cal month

for eg

               1st query

                         cal. month , total amount in result field

                         cal.month equal to prompt in query filter

               2nd query

                              cal. month , total amount in result filed

                              NOTE dont apply filter on cal month in 2nd query

after creating a 2 query

create a new variable calmonth


calmonth = FormatDate(RelativeDate(ToDate([UserResponse("cal month");"MMM yyyy");-28);"MMM yyyy")



create a new variable final cal month



final cal month = query2.cal month where query2.cal month <= calmonth





saurabh_sonawane
Active Contributor
0 Kudos

Hi

try this work around (with the help of input control)

1st

create a new variable DATE

date="MAY 2012"

create a new input control variable on date(use ENTRY FILED )

2nd create a new variable month -1


month-1 = =FormatDate(RelativeDate(ToDate([date];"MMM yyyy");-28);"MMM yyyy")


3rd


create a new variable cal.year1


=l01 cal.year where l01 cal.year<=month-1



Note


dont use prompt for cal month in query


arijit_das
Active Contributor
0 Kudos

v_PrevMonth =FormatDate(RelativeDate(ToDate(UserResponse("Enter Year/Month");"MMM yyyy");-1);"MMM yyyy")

Former Member
0 Kudos

Mani, Create an object at Universe level = add_months([cal.year],-1)

or use Relativedate() function in Web I.

Former Member
0 Kudos

HI,

My requirement is reduce month not year

Example:

suppose user input is Mar 2012

My output should come Feb 2012

Former Member
0 Kudos

Hi,

You can try this.

Create variables-

MonYear=UserResponse("Enter MON YYYY")


BackMon=If Substr([MonYear];1;3)="JAN" Then "DEC" ElseIf Substr([MonYear];1;3)="FEB" Then "JAN" ElseIf Substr([MonYear];1;3)="MAR" Then "FEB" ElseIf Substr([MonYear];1;3)="APR" Then "MAR" ElseIf Substr([MonYear];1;3)="MAY" Then "APR" ElseIf Substr([MonYear];1;3)="JUN" Then "MAY" ElseIf Substr([MonYear];1;3)="JUL" Then "JUN" ElseIf Substr([MonYear];1;3)="AUG" Then "JUL" ElseIf Substr([MonYear];1;3)="SEP" Then "AUG" ElseIf Substr([MonYear];1;3)="OCT" Then "SEP" ElseIf Substr([MonYear];1;3)="NOV" Then "OCT" ElseIf Substr([MonYear];1;3)="DEC" Then "NOV"

BackYear=If [BackMon]="DEC" Then FormatNumber(ToNumber(Substr([MonYear];5;4))-1;"#") Else FormatNumber(ToNumber(Substr([MonYear];5;4));"#")

BackMonYear=[BackMon]+" "+[BackYear]

You can use BackMonYear variable in your report.

~Anuj

former_member4998
Active Contributor
0 Kudos

Hi

Create Variable

V1 = User response calender year

V2= (V1- 1)


If you are showing results

Custmer  Sales Rev (V3 = Sales Rev where Calender year = V2)

11                200

12                400