cancel
Showing results for 
Search instead for 
Did you mean: 

WEBI - Cross Tab - rolling 12 months

Former Member
0 Kudos

= - datatype numeric

= - datatype numeric

In my webi report I want to fetch profit for for rolling 12 months show in cross tab for each year/month.

How do I fetch rolling 12 months

Accepted Solutions (1)

Accepted Solutions (1)

former_member198519
Active Contributor
0 Kudos

You have couple of options! What you can do is create a filter at the universe level with the below code, which will serve the purpose:

"Database date field" > add_months(trunc(sysdate),-12)

Or

at the webi report create a filter variable:

[filter]=if([Date]>Relativedate(Currentdate();-365)) then "Show" else hide

Set the variable to "Show"

P.S: Creating the filter at universe level is a best practice.

Former Member
0 Kudos

I have these two fields in universe so how will I write universe filter to get only rolling 12 months of data

[Report Year] = [2016,2015,2014,2013] - datatype Numeric

[Report Month] = [1,2,3,4,5,6,7,8,9,10,11,12] - datatype Numeric

[Profit]

[Product]


I dont have a date field but separate [Report Year] & Month

former_member198519
Active Contributor
0 Kudos

Can you give me some sample data to work on?

In the meantime can you try this:

=if([Month]>(MonthNumberOfYear(RelativeDate(CurrentDate();-365)-1)) and [Year]>Year(RelativeDate(CurrentDate();-365))) then "Show" else "Hide"

Former Member
0 Kudos

This will be filter on what sales?

Report YearReport MonthProductSales
20151ABC123
20152XYZ345
20153ABC567
20154CVB789
20155DFG1011
20156DFG1233
20157RTY1455Rolling 12 months start
20158UUI1677
20159oiu1899
201510kjh2121
201511lkj2343
201512mnb2565
20161mnb2787
20162poi3009
20163qwe3231
20164cft3453
20165vgy3675
20166bhu3897
20167nji4119Rolling 12 months end
Former Member
0 Kudos
o/p20162015
Products7654321 121110987
ABCSales
CVB
Former Member
0 Kudos

Kuldeep, any luck?

Where do I put the below formula? in Conditional formatting?

=if([Month]>(MonthNumberOfYear(RelativeDate(CurrentDate();-365)-1)) and [Year]>Year(RelativeDate(CurrentDate();-365))) then "Show" else "Hide"


I also have pasted sample data

former_member198519
Active Contributor
0 Kudos

Created two filter variable:

[Month]=[Report Month]>(MonthNumberOfYear(RelativeDate(CurrentDate();-365)))

[Year]= [Report Year]>Year(RelativeDate(CurrentDate();-365))

And condition would be Month=1 or year=1

Here is what i get

Former Member
0 Kudos

This works perfect, just one more thing. Can I do 13 months instead of 12 months? Not a hard requirement but the end user asked me if its possible.

Former Member
0 Kudos

Also can I create some kind of universe filter like 'rolling 12 months' in UNV so that I dont have to do this report filter in each report

former_member198519
Active Contributor
0 Kudos

if you have a date object then it would be very easy to create a filter for rolling 12 month, in your scenario the best way would be to use it like a filter. As for your other query, just change the 365 number to the number of days you want to go back.

Former Member
0 Kudos

rather than 365 days when the some months have 30/31/28 days wouldn't the 13 month calculation makes sense to be done more on some how by 'months'?

former_member198519
Active Contributor
0 Kudos

365 is the exact number of days in a year, that is the reason we are calling it a rolling 12 month period. If you need to add the 13th month as well, then you need to have a logic in place to check weather the month is of 30, 31 or 28 (in case of Feb)

Answers (0)