Proper use of AGO function
Dear All,
I have to report on cubes that have their data aggregated on the day level. Standard reporting works fine. Now I want to do some historic comparison. I therefore created some calculation columns in Administrator, e.g.
AGO(fact, dim_time.month,1)
which shall give me the value of the fact just one month (and quarter and year in other columns) ago. If I report this on a daily basis, e.g day, fact, fact_month_ago I can see the report and calculation is correct, fact_month_ago is exactly the sam as fact from one month ago.
But now I start to aggregate such a report to the month level (in Answers). So the report is month, fact, fact_month_ago. Now, some months are correct some are different. Looking deeper into this I assume this belongs to the number of days in a month. February has 28 days, so in the monthly report 28 lines are aggregated, even for the fact_month_ago table.
In this case month_ago is January, which has 31 days, but 29 to 31 are not aggregated, as the report goes only from feb 1st to feb 28th.
In the end the sum of the month_ago calculation is unequal to the sum of the last month.
Does this mean I cannot use AGO function to calcualte things like that, or is there any trick or other function that would help here ?
Regards,
Knut
You can have problem if you are going in a lower level such as week or date but if you stay on the month level, normally you must have the good result.
Check here to have an example of this problem:
http://obiee101.blogspot.com/2009/01/obiee-leap-year-challenge.html
Otherwise, check your set up:
http://gerardnico.com/wiki/dat/obiee/bi_server/design/dimension/time_dimension_parameters_for_ago_and_td_functions#timecalender_dimension_design_verification
See each punt that are listed under the paragraph Time/Calender Dimension Design Verification. A good time dimension is the key for a good result with the time series function.
Cheers
Nico
Similar Messages
-
NQSError: 22047] The Dimension used in AGO function must be referenced
Hi All,
I am selecting the following columns in the report:
1. Dimension.Product
2. Sales: Directly mapped to physical datasource
3. Prior Month Sales: calculated using the AGO function at the Month Level
4. Var from Prior Month : Sales - Prior Month Sales (Calculated at the Logical Level)
Time Dimensional Hierarchy is Year > Quarter > Month
I am getting the data for the same but when I apply Grand Total is throws the error:
nQSError: 22047] The Dimension used in AGO function must be referenced in the query. (HY000)
When I use the filter for the Month filed it is coming up fine but when I remove the month filter and apply on Year it doesnt work.
Can anybody please let me know how this works?This error is happening in request?
You have to apply filter MONTH because you are calling month in AGO function. Try to create YEAR AGO calculation and then try combining filters, you will see that then YEAR will be important, not month. -
Proper use of installFromAirFile() function in ApplicationUpdater
We have an AIR client app that is composed of several sub programs. We want to be able to push out automatic updates to all the programs. We have a system set up so that each program can download its own update. For reliability purposes we would like to instead download one large AIR package and have the sub programs install themselves from AIR packages on the local drive.
According to the documentationn found here:
http://help.adobe.com/en_US/AIR/1.5/jslr/air/update/ApplicationUpdater.html#installFromAIR File%28%29
You are supposed to be able to install from a locally stored AIR file but I can't seem to get it to work within a test program. Can anyone give me a hand working out the proper syntax?So I managed to figure it out, sorta.
I didn't end up using the installFromAirFile() function at all. I was able to use the applicationUpdater normally by just pointing it to a local update.xml which pointed it to a local update.air file. Here is what I did.
private function Update():void
var update:File = File.applicationDirectory;
update = update.resolvePath("Update.updaterTest.xml");
var updater:ApplicationUpdater = new ApplicationUpdater();
updater.updateURL = update.url;
updater.addEventListener(UpdateEvent.INITIALIZED, onUpdateInit);
updater.addEventListener(DownloadErrorEvent.DOWNLOAD_ERROR, onErrorEvent);
updater.addEventListener(ErrorEvent.ERROR, onErrorEvent);
updater.addEventListener(StatusFileUpdateErrorEvent.FILE_UPDATE_ERROR, onErrorEvent);
updater.addEventListener(StatusUpdateErrorEvent.UPDATE_ERROR, onErrorEvent);
updater.initialize();
private function onUpdateInit(event:UpdateEvent):void
event.currentTarget.checkNow();
private function onErrorEvent(event:ErrorEvent):void
Alert.show(event.toString());
With the update.xml formatted like this.
<?xml version="1.0" encoding="utf-8"?>
<update xmlns="http://ns.adobe.com/air/framework/update/description/1.0">
<version>1.1</version>
<url>app:/updaterTest.air</url>
<description>
<![CDATA[
Update
]]>
</description>
</update>
This seems to work like a charm. -
Hi,
I have a time dimension with levels AllTime, Year, Month, Week, Day. I set the chronological key to the day and created an Ago Measure in my fact. The repository global consistency was successful. However when I used it in answers, I got the following error message:
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 22040] To use AGO function, the storage level of the query ('[DIM_DATE.DIMENSION_KEY]') must be a static level. (HY000)
SQL Issued: SELECT DIM_DATE.CALENDAR_YEAR_NAME saw_0, F_TEST.MEASURE saw_1, F_TEST.YearAgoMeasures saw_2 FROM WMS ORDER BY saw_0
Does anyone have any idea please? Note that the DIM_DATE.DIMENSION_KEY is the primary key of the time dimension table.
Thanks a lot
MarijaHi Wildmight,
I restarted everything and got the "must be a static level. (HY000)" error fixed. Then I checked the chronological key in the level "year" but it seems not to be working. It's taking a long long time to show the results (I finally cancel it).
Reviewing the nqquery log file, I don't really get how obi retrieves the todate info, it uses the analytic function: ROW_NUMBER() OVER (partition by....), do you get the same?
Thanks again. -
How to calculate the measure for the next month using the AGO Function
Hi,
I need to calculate the measure for the current month and the next month.
Can anyone please let me know the syntax to use AGO function for the above requirement.
Regards,
Ambika Nanda.Hi.
You can also use Oracle analytic functions LAG and LEAD inside the EVALUATE obiee function. The second one will give you the next measure.
For example the report is:
TIMES.CALENDAR_MONTH_DESC
SALES.AMOUNT_SOLD
LAG column: EVALUATE('LAG(%1, 1) OVER (ORDER BY %2)' AS DOUBLE, SALES.AMOUNT_SOLD, TIMES.CALENDAR_MONTH_DESC)
LEAD column: EVALUATE('LEAD(%1, 1) OVER (ORDER BY %2)' AS DOUBLE, SALES.AMOUNT_SOLD, TIMES.CALENDAR_MONTH_DESC)
And the result is:
CALENDAR_MONTH_DESC--------AMOUNT_SOLD--------LAG--------------LEAD
2000-01----------------------------------8025513.84---------------------------8474475.88
2000-02----------------------------------8474475.88----- 8025513.84-----7439568.24
2000-03----------------------------------7439568.24------8474475.88-----7062040.48
2000-04----------------------------------7062040.48------7439568.24-----7497971.40
Regards
Goran
http://108obiee.blogspot.com -
How to use the AGO function to calculate the sum of the last 12 months?
year | month | amount
2009 | 01 | 100
2009 | 02 | 150
2009 | 03 | 120
2009 | 04 | 110
2009 | 05 | 155
2009 | 06 | 180
2009 | 07 | 105
2009 | 08 | 145
2009 | 09 | 200
2009 | 10 | 205
2009 | 11 | 150
2009 | 12 | 120
2010 | 01 | 225
SUM OF THE LAST 12 MONTHS OF 201001=>225+120+150+205+200+145+105+180+155+110+120+150 *1.865*
How do I do this? Could anyone help me?
Thanks.hi,
Create a dummy column in Fx
Use *Filter ( amount_col using date col= TimeStampAdd(SQLTSI_MONTH, -12 ,date_col)*
If u want to show at grand total level
Go with combine with similar request
same as u mentioned (1st criteria)
date_col, month, use the above formula (2nd criteria)
try this and let me know
Thanks,
Saichand.v
Edited by: Saichand Varanasi on Oct 7, 2010 7:27 PM -
Using AGO function with partitions
I have a situation where we have logical sources with the same repository folder that are partitioned. We would like to use the AGO function but are getting the following error:
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 22042] AGO function may not be used on '# Applied Invoices' because its source is horizontally partitioned. (HY000)
Has anyone had success using the AGO function with partitions? If not, do you have an alternate solution to the problem?AGO doesn't work with partitions - it's documented on metalink....there's an enhancement request , but that's it - no work-around provided....I'd suggest creating a common view for that particular report
-
Hi ,
I am not able to understand the reason behind using Nested AGO functions.
In one of the logical columns (Sales LastYear LastWeek) the mapping was in the following fashion:
Ago(Ago("Core"."Fact - Retail Inventory Receipts"."Receipts Retail" , "Core"."Date Retail Fiscal Calendar"."Fiscal Week" , 1) , "Core"."Date Retail Fiscal Calendar"."Fiscal Week" , 52)
Is it the same as writing a ago function with period of 53?
Like this:
Ago("Core"."Fact - Retail Inventory Receipts"."Receipts Retail" , "Core"."Date Retail Fiscal Calendar"."Fiscal Week" , 53)
Please help me understand.
Thanks for your help.
AnandHi Anand,
This is how I interpret the function:
Display the fact 'Receipts Retail' for the current fiscal period minus one fiscal week minus 52 fiscal weeks. So basically: Display the fact for the current fiscal period minus 53 fiscal weeks.
However, since the column is named 'Sales LastYear LastWeek', this definition is a bit tricky. The formula is only true, if the fiscal year consists of 52 fiscal weeks (most of the time this is correct, but you never know!). I would prefer changing the second part of the forumula to Fiscal Year, 1:
Ago(Ago("Core"."Fact - Retail Inventory Receipts"."Receipts Retail" , "Core"."Date Retail Fiscal Calendar"."Fiscal Week" , 1) , "Core"."Date Retail Fiscal Calendar"."Fiscal Year" , 1)
This will substract a fiscal week and a fiscal year.
I hope this helps.
Regards,
Marco Siliakus -
Level based measure and AGO function
Hi,
I've a TIME fact table with a single dimension (TIME_DIM) and a single measure (WORK_DAY).
WORK_DAY is 1 if the day is a working day, otherwise it is 0.
This way I can get the number of working days by month, quarter and year.
(TIME is a logical fact table. WORK_DAY is phsical stored inside the physical TIME_DIM).
To have WORK_DAY work correctly when used with others fact tables, I've defined it as a level based measure, where all the dimensions are set to the "total" level, apart TIME_DIM.
So far so good.
Then I created a new calculated measure WORK_DAY_PREVIOUS_YEAR.
I used the AGO function this way: AGO (TIME.WORK_DAY, TIME_HIERARCHY.YEAR, 1)
No complains by OBIEE, but this column always returns 1...
I've no trouble using level based measures.
I've no trouble using AGO.
But if I mix them together they no longer work.
Do you experience this issue? Any workaround?
I'm using OBIEE 11.1.1.5
Regards,
CorraodWhat is the month level key column functionality in your time dimension?
it should be in format of yyyymm but not in just mm .. -
Hello
Im trying to use the AGO function in in my Column Formula to compare the difference between month to month. The formula is as follows:
AGO("Fact - Revenue"."Revenue - DW","Period"."Period",1)
... but every time im getting the error message:
Formula syntax is invalid.
[nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27037] Unresolved level: "Period"."Period". (HY000)
SQL Issued: SELECT AGO("Fact - Revenue"."Revenue - DW","Period"."Period",1) FROM "LC ELT - Revenue and Margin"
Not sure why this is. I have tried not inserting the 'time level' option which doesn't give me an error but does give me slightly incorrect results, just off the correct value.
Has anyone experienced this before? If so, could you please let me know what you did to resolve it?The Ago syntax is
Ago(<<Measure>>, <<Level>>, <<Number of Periods>>)
I dont think "Period"."Period" is a level from time dimension.
In your case valid Levels are
- Year
- Half
- Quarter
Pls mark as correct/helpful if helps
Edited by: veeravalli on Nov 19, 2012 5:31 PM -
Hi All,
I was performing the steps mentioned in Oracle Tutorial"http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi11115/biadmin11g_02/biadmin11g.htm#t10"-BI RPD creation.
After Using the AGO function data in the Time series metric(Month Ago Revenue) was null always. I updated the DB features in RPD physical layers by selecting support for time series functions.
After that report started to fail with below error. Please let me know if its a bug and any option to fix it.
Thanks,
Sreekanth
Error
View Display Error
Odbc driver returned an error (SQLExecDirectW).
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 46008] Internal error: File server\Query\Optimizer\SmartScheduler\PhysicalRequestGenerator\Src\SQOSPMarkMultiTargetSupport.cpp, line 1680. (HY000)
SQL Issued: SELECT 0 s_0, "Sample Sales"."Time"."Year-L1" s_1, "Sample Sales"."Revenue"."Ago-Year Revenue" s_2, "Sample Sales"."Revenue"."Revenue" s_3 FROM "Sample Sales" FETCH FIRST 65001 ROWS ONLY
RefreshI know that there is no relation between "SampleApp Lite"."D3 Orders (Facts Attributes)"."Order Date", "SampleApp Lite"."D0 Time"."Calendar Date", it's also the same thing in my own RPD.
But as it's working with the 11.1.1.6.2 BP1 version I don't understand why it's not working with 11.1.1.6.9.
Implicit fact column is not set on my repository, but I don't have any request with only dimensional column, so if my understanding is correct I don't need to use it. Also, the problem appears during the check of the repository not in answers.
thanks anyway -
Ago function not working in reports
Hi
I created a logical column using ago function,when I'm using this column in the report it throws the following error.I'm using 10.1.3.4.1 version of OBIEE.
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 22040] To use AGO function, the storage level of the query ('[TIMES.TIME_ID]') must be a static level. (HY000)
SQL Issued: SELECT COUNTRIES.COUNTRY_NAME saw_0, SALES.AMOUNT_SOLD saw_1, SALES."Amount Sold LY" saw_2 FROM KNOWLEDGE WHERE (TIMES.CALENDAR_YEAR = 1999) ORDER BY saw_0
Thanks
Don.Hello Don,
Have you set the chronological key for the time dimension ?
Please refer the below post by Nico..
http://gerardnico.com/wiki/dat/obiee/function_time?s[]=ago&s[]=function
Same error it has been posted in below mentioned thread
Re: Using the Ago Function
One Request : Please if your post has been answered then please try to close the thread by awarding so that it can be helpful to others.
thanks
Edited by: user12116294 on Feb 4, 2011 5:18 PM
Edited by: user12116294 on Feb 4, 2011 5:20 PM -
Hi All
I need to use a ago function for month comparision in obiee, but actually the column which i am using has alsoi '*' characters and also numbers so i am unable it aggregate the column and use it as a measure for calculating the Month Ago.
Please help me in this regards
ThanksExtract the actual dates then so you have a date column. Then use the AGO function on it.
BTW, what do you mean by "*" characters? What kind of "dates" are they?? -
AGO function error in Pivot Table
Hi,
I have a typical time dimension - year, period, week, date. Most of my facts are available at the most detailed level of date however I have some Budget facts that are only available at the week level. When I combine these facts in a report I am having the below problem.
I use an ago function at the yearweek level ( I needed this so that I can compare week numbers as oppposed to week date ranges which is how the year ago function works - I believe).
If I have a total on year in my pivot table I get the below error -
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 22036] Level in AGO function (YearWeek) must be a rollup of (or equivalent to) the measure level (Year). (HY000)
Has anyone come across this before ?
Thanks
PatriciaI am getting the following error message, not sure how to get rid of this.
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 22036] Level in AGO function (Fiscal Period) must be a rollup of (or equivalent to) the measure level (Fiscal Year). (HY000)
SQL Issued: SELECT "GL Calendar"."Fiscal Period" saw_0, "Project Manager"."Project Manager Name" saw_1, Project."Project Number" saw_2, Project."Business Area" saw_3, Project."Business Unit" saw_4, Project."Delivery Ownership" saw_5, Project.Programme saw_6, "Fact - Project Cost".Cost saw_7, "Ago Measures"."MAGO Cost" saw_8, "Fact - Project Cost".Cost-"Ago Measures"."MAGO Cost" saw_9, REPORT_SUM(saw_7 BY ), REPORT_SUM(saw_8 BY ), AGGREGATE(saw_9 BY ) FROM "Project - Cost" WHERE ("GL Calendar"."Fiscal Year" = '2011') ORDER BY saw_0, saw_1, saw_2, saw_3, saw_4, saw_5, saw_6 -
OBIEE 10g AGO Function Dynamically Change the Heading
I created columns in my rpd named Sales Previous Month, Sales 2 months ago and Sales 3 months ago using the AGO Function. This is working fine.
My problem is when displaying these headings the users would like to see the Month Name instead of the Headings I created. For example if looking at a report for January the users would like to see:
Sales Previous Month = December
Sales 2 Months ago = November
Sales 3 Months ago = October
Is there any way to dynamically change the value of the column header to show the name of the month?Hi SriniVEERAVALLI,
Thanks for the reply. I have found that I might haven't created the relationship between dimension and fact tables correctly.
I initially created the foreign key relationship (instead of creating complex join) in physical diagram between the dimension and fact table. And the relationship type is hence greyed out.
I have deleted the foreign key relationship in physical diagram. Then
1. In physical diagram, create complex join between dimension and fact . The relationship is 'inner' and can't be changed.
2. In Logical table diagram, create foreign key between dimension and fact . The relationship can be changed (inner, outer, etc).
Is this the correct way?
I tried these on two newly created dummy tables and it worked.
Maybe you are looking for
-
IPod no longer connects to computer
Don't know what happened. If I plug my iPod in to charge using one of those cube chargers it works, but when I plug it in to my computer it won't bring it up on Finder and iTunes doesn't automatically run. Don't know what to do, wondering if I have t
-
OS command in PL/SQL ??
Has Oracle come up with the feature of executing OS commands within stored procedures yet? Anyone aware of such thing? Thanks. null
-
Managed server not running.
Hello. I execute the managed server. But the Managed server does not running. Why the error occurred in the server? D:\bea\wlserver6.1>"D:\bea\jdk131\bin\java" -hotspot -ms64m -mx64m -classpat h ". .;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;.\samples
-
Tool or idea wanted...how to remove an object in a frame
After Effects. CC2014.xxx Yesterday I effectively removed a small skin mole on a close up of a hand ( in movement) by using Simple wireframe Tool. ( and key frames) EAsy as it was at the time... I wondered if there was a better tool or technique to d
-
Sftp crashes Lightroom 3.2rc
If I try to do a web gallery upload using sftp Lightroom crashes every time. I'm running 3.2rc on Windows 7 x64 8gb ram, Core i5.