cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate ' Month - 1' in web intelligence 3.1?

Former Member
0 Kudos
2,350

Hello All,

While designing webi report I want to display previous month in the table.

eg:--

Aug -- Jul -- June -- May -- June .............like wise.

I know the inbuilt function to calculate previous date... that is ...

=RelativeDate(CurrentDate();-1)

but how to calculate previous month ?

Thank you.

Regard's,

Bhushan.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

So If consider Island Resort Marketing, you have the following Objects:

Country, Sales Revenue and Invoice date in format(dd/MM/yyyy)

Current requirement is:

to display say a crosstab:

-


Aug-10 July-10 Jun-10 May-10 April-10 March-10 Feb -10 Jan-10

-


US 103 343 34 34 5676 5656 565 565

France 45 454 454 454 ......

Japan

Please correct me if that is wrong.

If this the case then...

1. Create an Object Month of year- [invoice date] where year="2010" or any other will be fine.

2. use [YearMonthname] =FormatDate([Month of year]);"dd/MMM/yyyy" to get the month name.

3. Use Substr([YearMonthname];4;3) to get only Month Name, call it [Month Name]

4. Drag the object to the report and apply Custom Sort to it to appear in the order in which you want it to display.

5. if Year required along with Month then concatenate with Year too.

If this is not the case then let me know.

Regards,

Velly

Former Member
0 Kudos

Hello Velly,

Thank you very much.

This works.

Regard's,

Bhushan

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

I want to display the name of the month in table.

Former Member
0 Kudos

I am not able to get you exactly but what I got is-

You have two columns in the report, one is month and the next column you have previous month. (Please ignore if I am wrong)

To accomplish this you can use Previous([Month];1)

But before this you need to custom sort the months in the 1st column.

Else can you explain your requirement a bit in detail.

Regards,

Rohit

Former Member
0 Kudos

You can try one of the following:

If(DayNumberOfMonth(CurrentDate()) = 31) Then Month(RelativeDate(CurrentDate();-31)) Else Month(RelativeDate(CurrentDate();-30)) 

OR

You can write an if else logic with 12 hard coded conditions for returning the previous month name.

Regards,

Rohit