Using AGO function in calculated fields in Analysis

Oracle BI 11g.
Hi!
I have time-hierarchy and try to use function Ago in calculated fields. I created Analysis and add columns Year, Revenue, Revenue (1 year ago). In formula of column "Revenue (1 year ago)" I wrote:
AGO("Sales"."Revenue", "H Calendar"."Year", 1)
"H Calendar"."Year" - is level in my time Hierarchy "H Calendar".
But when I clicked [OK], I got error: [nQSError: 27037] Unresolved level: "H Calendar"."Year".(HY000)
What I do wrong?

Hi,
I think it's a bug, try this.
If Analysis you have a time folder with this object dimension:
Time Hierarchy
Total Time
Year
Quarter
Month
Week
Day
And a measures 1- Revenue try to calculate the criteria like this (write in the level the formula "Time"."Time Hierarchy".Year)
For example:
AGO("Base Facts"."1- Revenue", "Time"."Time Hierarchy".Year,1)
If you have the sample sales of the 11g installed try this on A - Sample Sales
SELECT s_0, s_1, s_2 FROM (
SELECT
0 s_0,
"A - Sample Sales"."Time"."T05 Per Name Year" s_1,
AGO("A - Sample Sales"."Base Facts"."1- Revenue","Time"."Time Hierarchy"."Year",1) s_2
FROM "A - Sample Sales"
) djm ORDER BY 1, 2 ASC NULLS LAST
For me it works.
Regards,
Gianluca

Similar Messages

  • How can I use AGO function with aggregates

    I use aggregated table and a detailed table
    I have time hierarchy whose lowest level is date. For sales I
    created year-to-year (YTD) comparision with AGO function. It
    works OK.
    BUT, I want to speed it up, so I used aggregates. I created new
    time table grouped by MONTH and corresponding agg_SALES table. I
    created connections and mapped the fields. It works OK for
    normal queries, that means my queries at month level use
    aggregates. BUT when I add YTD measures or YAGO measure in query, it goes to
    then SALES table whose grain is date.
    How can I force BI Server to use AGO function with aggregates?
    I use OBIEE 10.1.3.4
    Thank you
    Ishaq
    (Question originally taken from ITtoolbox and posted by Gorazd)
    SORRY - THE QUESTION IS IN THE WRONG FORUM
    Edited by: ishaq12 on Nov 19, 2008 12:21 PM

    Hi,
    you can not do it in Administration tool but you can set agregation for that field in Answers (fx->Agregation rule->Sum) and effect should be the same. Note that it may not work properly on Oracle 10g as generated SQL is not 100% recognized, on 11g everything is OK (at least in my case).
    Regards,
    Marko
    Edited by: user10449532 on 2008.11.19 06:29

  • Problem using Ago function

    Hi all,
    My problem is that when i use ago function it displays next months value for example first column shows balance of april month and next to it ago column displays balance of the may not march. I am really confused. Please help,
    AGO(SR02BriefIncome.sr02_cube.BALANCE, SR02BriefIncome.timesDim."times Detail", 1);

    Hi Nico,
    Another question in relation to Ago function; I need to get value/balance a year ago which is 12 months ago, and also previous year's last months balances; the problem is that Ago function takes only integer, I have tried to put a variable, Is there is way i can get balances of the previous year's last month because it will be much easier to get it using built-in ago function.
    Also i need help with your answer for thread How to use row values in Presentation or Administration for calculation
    Re: How to use row values in Presentation or Administration for calculation
    "Yes, I forgot this one. Of course, this solution work when you have a pivot column.
    If you talk about period to period comparison, really often I must do a share like this one : ($2-$5)/$5.
    And unfortunately, this is not possible in a calculated item. Is it ?"
    We have a lot of reports with inter-row calculations, we have already used a lot sql model but we would like use answer also. Can u explain it with exact examples or steps.
    thank you again,

  • Error while using Ago function

    hi all,
    OBI 11.1.1.7.1
    I am unable to view data on result tab. No value returned in Calcutated Attribute. Please Help
    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: 22040] To use Ago function, the storage level of the query ('[Time Dim.PAY_DT]') must be a static level.Please have your System Administrator look at the log for more details on this error. (HY000)
    Regards,
    Nivedita

    Substr("Fin Account".ASSET_NUM, 1, instr(Fin Account".ASSET_NUM, ':')+1)
    or
    Substr("Fin Account".ASSET_NUM, instr(Fin Account".ASSET_NUM, ':')+1,50)
    i think you should use 3 parameters, did you try that if it would work?
    additionally check what is the default format of your data: go to column properties -> data format; if its text then ok; otherwise you will have to cast the number to char; in such a case the above could be:
    Substr(cast("Fin Account".ASSET_NUM as char(20)), 1, instr(cast(Fin Account".ASSET_NUM as char(20)), ':')+1)
    or
    Substr(cast("Fin Account".ASSET_NUM as char(20)), instr(cast(Fin Account".ASSET_NUM as char(20)), ':')+1,50)
    Edited by: UserMB on Jun 25, 2009 6:17 AM

  • SSRS Using WHERE in a calculated field

    Hi All,
    Im having a real issue with something that seems like it should be easier than it is.
    In my tablix I want to add the expression =Sum(Fields!ID20.Value)-Sum(Fields!ID20.Value) BUT I need to determine if another criteria is met.
    EG - I want =Sum(Fields!ID20.Value WHERE [InOut]="In")-Sum(Fields!ID20.Value WHERE [InOut]="Out")
    Many Thanks for any help

    Hi LB79,
    In Reporting Services, Aggregate functions cannot be used in calculated field expressions, since the data for calculated fields will be based on individual rows not on group basis. As a workaround, we can directly add the expression to a textbox of the tablix
    instead of using that calculated field. For detail information, please refer to the following steps:
    Right click the text box which you want to insert the calculated field, then click Expression.
    In the Expression text box, refer to the following expression:
    =sum(iif(Fields!InOut.Value ="In", Fields!ID20.Value,0),"DataSet_name")-sum(iif(Fields!InOut.Value ="Out", Fields!ID20.Value,0),"DataSet_name")
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to use Ago function in BIEE with mysql database

    Hi experts,
    Ago function works well in Oracle database,but when I tried a mysql database,it didn't show results as expected. Anyone knows how to use Ago with mysql as data source?

    Hi Gurus, need help

  • 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

  • Using PRE Function to report field changes

    Hi Everyone,
    As they reporting on audit trail is not available, I was wondering if there was a work around using the PRE function (or any other way) in analytics.
    We're looking to track Revenue changes with respect to Opportunities (so, if Opp A's Revenue ever changed since the first time the $ amount was submitted) - we're especially interested in reporting on weekly changes. If the weekly isn't possible, tracking any change would be helpful.
    Any suggestions?
    Thanks!

    Why not create a workflow using the PRE() function to record the changes in a Task, you could then report on that task.
    cheers
    Alex

  • How to use MAX() function with date field

    Hi Frzz,
    I have created a Graphical calculation view in which i have multiple records for each employee with different dates. But my requirement is to take the records which have maximum date.
    I have converted the date into Integer and applied the MAX() function. But still am getting multiple records.
    Is there is any other way we can achieve this requirement in Graphical Calculation view??  Your suggestion will really help me.
    Thank  you.
    Krishna.

    Hmm... what have you tried out so far?
    Look, I took the effort and created a little example, just for you
    Assume we have a table that contains the logon dates of users.
    Every line contains the logon date and some info on the user.
    Very much like a not-normalized log file could look like.
    Now, the output we want is: one line per user with the most current logon time.
    Not too difficult:
    1. Have a aggregation node that gives you the distinct user details - one line for every user:
    2. Have another aggregation node that gives you the last (MAX) logon date per user:
    Finally you do a 1:1 join on the USER_ID and map the result to the output.
    Easy as pie
    - Lars

  • 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

  • AGO Function doesn't use full previous period

    Hi,
    I am using ago function in obiee 11.1.1.6. If my current period is April, AGO (quantity, MONTH, 1) only returns the data from 1 to 30th of March and not the full month. Seems it's trying to match the number of days in the current month and uses the same number of days in the previous month. Is this the known issue? Is there any workaround? I want full month data for the previous month using AGO function.
    TIA

    HI,
    Obviously it must use all the dates from the previous months, just check with dimension hierarchy you created.
    Take a look @ this mkashu.blospot.com/2013/08/obiee-model-time-series-in-obiee.html
    Regards,
    VG

  • Using aggregates in AGO function

    Hello!
    I want to use AGO function that would use aggregates.
    Requirements:
    I want to be able to make year-to-year comparision, where I compare period based on specific dates
    This same year-to-year comparision I want to speed up using aggregated fact tables grouped on months level.
    I created aggregated SALES table and aggregated time table (group by month) and it works OK with normal queries. It uses aggregated tables when apropriate (possible)
    When I use AGO function it always goes to fact table, which time dimension is at lowest level (i.e. date). How can I force BI server to use monthly aggregated tables in AGO function?
    Any tip, workaround?
    BI server 10.1.3.2.1
    Thank you,
    Gorazd
    Message was edited by:
    gor
    Message was edited by:
    gor

    I tested it and in case of AGO function it goes to detailed fact table SALES instead on agg_sales. Any tips?
    Gorazd
    Message was edited by:
    gor

  • Using the Ago Function

    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
    Marija

    Hi 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

  • Problem with AGO function in OBIEE

    Hi I am new to OBIEE,
    I am working on Trend Analysis of ETL Mappings,
    I am using AGO Function to get the Previous day Elapse Time of a mapping but while generating the report its behaving in a strange way.
    like
    AGO("BI Performance"."Map Val Fact"."Elapse Time Minutes","BI Performance".ETLStartDim."Day",1) -- Day Ago Elapse time
    AGO("BI Performance"."Map Val Fact"."Elapse Time Minutes","BI Performance".ETLStartDim."Day",2) -- Two Day Ago Elapse time
    For example, in database there is date like
    Date Elapse Time
    2nd June 10 min
    1st June 11 min
    30th may 10 min
    My date in Report should be like
    Date Elapse Time Day Ago Elapse Time Two Day Ago Elapse Time
    2nd June 10 11 10
    But the date coming over here is
    Date Elapse Time Day Ago Elapse Time Two Day Ago Elapse Time
    2nd June 10
    3rd June 10
    4th June 10
    So if any one could help me out of this, it would of great help.
    With Regards
    Chaitanya

    This is posted to the incorrect forum. Please post to an OBIEE forum.

Maybe you are looking for