Monday, January 14, 2013

[OBIEE11g] Ago Function in Answers

The syntax of the the ago function as documentation in Answers is:
AGO(expr, time_level, offset)

However, as with the administration tool, there is a overloaded version of AGO:
AGO(expr, offset)

which uses the grain of the Answers query as the level.

As an example using Sample Sales lite the function AGO("Base Facts"."Target Revenue",1) gives the revenue one time period ago. If the report is at the year level then that will of course be one year ago: 



The Disadvantage of the feature is that there is no way to select the time level.

If you got the error nQSError: 27037, the syntax is to use the time hiearchy level:

AGO("Base Facts"."Revenue", "Time"."Time Hierarchy"."Year", 1)

Note the time hierarchy needs to be exposed to the presentation layer.



This way you can have a report at say quarter level and compare the revenue of a year ago quarter by quarter: