Ago function with offset parameter dynamic

Hi,
I need to calculate a measure in rpd or answer that simulate the behavior of ago function with the offset parameter dynamic.
i.e.
ago(total_quantity, month, offset), where offset is a number provided by a logical column.
Is it possible?
Thanks.

Hi,
The problem is that I only know the offset values at row level, i.e., when I run my answer report some records use a certain offset value (offset1) while others use another offset value (offset2)
The offset value can be determinate by a logical column.
Is it possible?
Thanks.

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

  • How to use INVOKE function with INT parameter types

    Can you tell me how to use invoke function with int parameter type ?

    Pass the int as an Integer.

  • 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

  • Ago function with two dates

    I use OBIEE and I got some difficulties with the times dimensions and the function AGO because I used two differents dates for my measure.
    My fact table:
    Ordered ||Delivered||Amount
    12/21/2008 ||1/20/2009||30000
    1/1/2009 ||2/1/2009 ||20000
    1/1/2009 ||3/1/2009 ||10000
    2/1/2009 ||2/1/2009 ||50000
    2/1/2009 ||3/1/2009 ||50000
    12/25/2009||1/15/2010||10000
    1/1/2010 ||2/1/2010 ||25000
    1/1/2010 ||3/1/2010 ||20000
    1/1/2010 ||2/1/2010 ||20000
    1/1/2010 ||3/1/2010 ||15000
    I have two Times Dimensions (Ordered Times AND Delivered Times) and one fact table. I already tried with 2 facts table and 1 time table without success too cause they not link the value for delivered and ordered
    I want to compare the delivered situation (Amount Qty) for the same ordered day last year
    I created a prompt with a date (ex.: Ordered date <=1/1/2010 AND Delivered date >=1/1/2010) and I want to compare one year ago with 1/1/2009 (Ordered Date situation…)
    I wish the results below:
    Delivered Month||Amount||Previous Amount Year Ago
    1 || 10000 || 30000
    2 || 45000 || 20000
    3 || 35000 || 10000
    I got some problem cause I had the 100 000 in my previous year (Ago) and I don’t want it because it was ordered after 1/1/2009 (Previous year). I know that the ago function concerns the Sum of Amount by Delivered Date, Year -1 ...
    Does somebody has a solution for this ? Thank you

    Hi,
    The problem is that I only know the offset values at row level, i.e., when I run my answer report some records use a certain offset value (offset1) while others use another offset value (offset2)
    The offset value can be determinate by a logical column.
    Is it possible?
    Thanks.

  • Ago Function with multiple Facts

    Hi,
    I have two fact tables that are coneccted to the same time dimension. One of this fact has a column that uses the AGO function. In Answers when I select the column with the function and any other from the other fact, I get the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14026] Unable to navigate requested expression: Ago(VAL_PUBLICIDADE:[DAggr(F_PUBLICIDADE_MENSAL.VAL_PUBLICIDADE by [ D_CANAL.COD_CANAL, D_CANAL.NOME_CANAL, D_TEMPO_MES.Mes, D_TEMPO_MES.Ano, F_PUBLICIDADE_OBJECTIVOS.VALOR_BRUTO_OBJECTIVO] )], [Level Ano], 1). Please fix the metadata consistency warnings. (HY000)
    The metadata is consistent, there are no errors on the Administrator... Is it possible to do?

    Hi,
    The problem is that I only know the offset values at row level, i.e., when I run my answer report some records use a certain offset value (offset1) while others use another offset value (offset2)
    The offset value can be determinate by a logical column.
    Is it possible?
    Thanks.

  • Bind Operator to Function with optional parameter

    Hi,
    as mentioned in the subject, I would like to create an operator which is bind to an function with an optional parameter:
    CREATE OR REPLACE FUNCTION
              TS_Base_Func(iobject IN CIBase, format IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2 IS
    BEGIN
         RETURN interval_object.IntervalToString(format);
    END TS_Base_Func;
    I can bind the operator with a VARCHAR2 as second parameter, but how can I bind an operator without the second parameter to this function?
    Thanks!

    What about using a "wrapper" function to implement what you would like to do? Here is a small sample:
    SQL> CREATE OR REPLACE FUNCTION TEST
      2  (
      3          A       IN VARCHAR2
      4  ,       B       IN VARCHAR2     DEFAULT NULL
      5  )
      6  RETURN NUMBER
      7  AS
      8  BEGIN
      9          IF A = B THEN
    10                  RETURN 1;
    11          ELSE
    12                  RETURN 0;
    13          END IF;
    14  END;
    15  /
    Function created.
    SQL> CREATE OR REPLACE FUNCTION TEST_WRAPPER
      2  (
      3          A       IN VARCHAR2
      4  )
      5  RETURN NUMBER
      6  AS
      7  BEGIN
      8          RETURN TEST(A);
      9  END;
    10  /
    Function created.
    SQL> CREATE OR REPLACE OPERATOR TestOperator
      2  BINDING (VARCHAR2)              RETURN NUMBER USING TEST_WRAPPER
      3  ,       (VARCHAR2, VARCHAR2)    RETURN NUMBER USING TEST;
    Operator created.
    SQL> SELECT  TestOperator(1) FROM DUAL;
    TESTOPERATOR(1)
                  0
    SQL> SELECT  TestOperator(1,2) FROM DUAL;
    TESTOPERATOR(1,2)
                    0
    SQL> SELECT  TestOperator(1,1) FROM DUAL;
    TESTOPERATOR(1,1)
                    1
    SQL>The TEST_WRAPPER function has the signature you need for a one variable parameter. However, under the hood it calls the TEST function.

  • Activating explanation function with application parameter

    Hello,
    I found in documentation that it's possible to activate explanation function (mouse over) with url parameter sap-explanation=X. Is it also possible to activate explanations with application parameter, application configuration or GLOBAL_SETTINGS?
    Thanks and regards
    Marc

    I remember that JSF provides no support for accessing the indexed values as I right understand you.

  • Ago function with full past year

    I want to create an ago function. But if the ago function is for the full past year and not only for the same current period.
    Example:
    Period ||YEAR || Amount
    1 || 2008 || 10
    2 || 2008 || 10
    3 || 2008 || 10
    4 || 2008 || 10
    5 || 2008 || 10
    6 || 2008 || 10
    7 || 2008 || 10
    8 || 2008 || 10
    9 || 2008 || 10
    10 || 2008 || 10
    11 || 2008 || 10
    12 || 2008 || 10
    1 || 2009 || 5
    2 || 2009 || 5
    3 || 2009 || 5
    4 || 2009 || 5
    Report for year 2009 period 4 should be
    YEAR || TODATE || AGO
    2009 || 20 || *120*
    Does somebody has a solution for the result 120, Thanks

    Hi Jim,
    In your BMM layer create a duplicate column for the amount and name it as ago.
    double click that and make the source expression as AGO(amount, year,-1) like that.. i dont remember the exact synatx. but the point is give the column name for which year ago value needs to be calculated, parameter to be taken into account eg year or month or week and no. of year or month.
    and in the aggregate column use sum.
    use this column in your report it will give 120.
    if it doesn't work please tell us.
    Thanks,
    karthick

  • AGO functions with diferent time attibutes

    i have problem! i have too columns Year ago and month ago. When i take these columns with Month i can see only results from Month Ago (Year ago is no results), but when i take year and year ago i can see results from year ago. How can ia see year ago results with month column?????
    My Ago functions :
    Month ago: Ago("RU"."FSG fact - Budget"."Budget sum" , "RU"."WH Dim - TimeDim"."period" , 1) period is like (2008.01; 2010.02; ....)
    Year ago: Ago("RU"."FSG fact - Budget"."Budget sum" , "RU"."WH Dim - TimeDim"."Year" , 1) year is like (2008; 2010;....)
    please help !!!!!

    For Month_Ago column i set level Period and for Year_Ago level Year! but i still get problem - when i take fact column with MonthAgo and YearAgo columns and Month column from time dimension, MonthAgo works fine, but YearAgo shows '0' in all months and in the end of table after last moth shows all sum by year !
    and i have also Time dimension made from 2 Logical source tables!
    when i use grand total level i get error massege:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 22047] The Dimension used in Ago function must be referenced in the query. (HY000)

  • Rfc function with table parameter

    Hey,
    im trying to call a RFC function from Webdynpro where i have to give a table as parameter.  When creating the table i following exception:
    java.lang.IllegalArgumentException: model object must not be null
         at com.sap.tc.webdynpro.progmodel.context.ModelNodeElement.<init>(ModelNodeElement.java:66)
         at be.vrt.wdp.IPublicPlanning_Validation$IP_Update_TableElement.<init>(IPublicPlanning_Validation.java:3667)
         at be.vrt.wdp.IPublicPlanning_Validation$IContextNode.doCreateElement(IPublicPlanning_Validation.java:87)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.createElement(NodeInfo.java:854)
         at com.sap.tc.webdynpro.progmodel.context.Node.createElementInternal(Node.java:1346)
         at com.sap.tc.webdynpro.progmodel.context.Node.createElement(Node.java:1365)
         at be.vrt.Planning_Validation.executeRFC_Z_Whatson_Sap_Update_Transmissio_Input(Planning_Validation.java:265)
    The code from Planning_Validation (controller class)
      public void executeRFC_Z_Whatson_Sap_Update_Transmissio_Input( java.util.Vector nodes, java.lang.String display_value )
        //@@begin executeRFC_Z_Whatson_Sap_Update_Transmissio_Input()
         Z_Whatson_Sap_Update_Transmiss_Input transmiss = new Z_Whatson_Sap_Update_Transmiss_Input();
         //transmiss.addP_Update_Table(new Zmm_S_Update_Status_Table());
         wdContext.nodeZ_WHATSON_SAP_UPDATE_TRANSMIS().bind(transmiss);
         //wdContext.createP_Update_TableElement(new Zmm_S_Update_Status_Table());
         for (int i = 0; i < nodes.size(); i++){
              String [] node = (String[])nodes.get(i);
              IWDNodeElement el = wdContext.nodeP_Update_Table().createElement();
              el.setAttributeValue("Won_Id", node[0]);
              el.setAttributeValue("Won_Status", node[1]);
              el.setAttributeValue("Display_Status", display_value);
         try {
              // Call remote function          
              wdContext.currentZ_WHATSON_SAP_UPDATE_TRANSMISElement().modelObject().execute();
              // synchronise data in context with data in model
              wdContext.nodeOutput().invalidate();
         } catch (WDDynamicRFCExecuteException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    Line 265 is where i call wdContext.nodeP_Update_Table().createElement();
    Any ideas ?
    grtz,
    Hannes

    Hey, thanks .. i managed to solve it
    this is the code: 
    //@@begin javadoc:executeRFC_Z_Whatson_Sap_Update_Transmissio_Input()
      /** Declared method. */
      //@@end
      public void executeRFC_Z_Whatson_Sap_Update_Transmissio_Input( java.util.Vector nodes, java.lang.String display_value )
        //@@begin executeRFC_Z_Whatson_Sap_Update_Transmissio_Input()
         Z_Whatson_Sap_Update_Transmiss_Input transmiss = new Z_Whatson_Sap_Update_Transmiss_Input();     
         wdContext.nodeZ_WHATSON_SAP_UPDATE_TRANSMIS().bind(transmiss);
         for (int i = 0; i < nodes.size() ; i++){
              String [] node = (String[])nodes.get(i);          
              Zmm_S_Update_Status_Table updEl = new Zmm_S_Update_Status_Table();
              updEl.setWon_Id(node[0]);
              updEl.setWon_Status(node[1]);
              updEl.setDisplay_Status(display_value);
              transmiss.addP_Update_Table(updEl);                    
         wdComponentAPI.getMessageManager().reportSuccess("wohoo!");
         try {
              // Call remote function          
              wdContext.currentZ_WHATSON_SAP_UPDATE_TRANSMISElement().modelObject().execute();
              // synchronise data in context with data in model
              wdContext.nodeOutput().invalidate();
         } catch (WDDynamicRFCExecuteException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
        //@@end

  • Ago Function with Select Table--HELP!

    When my physical layer was setup using all 'Physical Table' types, my time series functions were working.
    I had to modify my fact table to be of a 'Select' type (using SQL). When I remap my data, my time series functions fail with the following message:
    "[nQSError: 22038] Function AGO requires at least one measure attribute in its first argument."
    We have to be able to use select tables with time serious functions--what am I missing!?
    Thanks!!

    does your new 'select table' contain the same number of columns with same datatypes?
    did you restart the services (if developing in online mode- which is not recommended)
    Lastly, if all fails,can you create those views on the database rather than in the physical layer?

  • How to execute a function with date parameter as an input?

    HI
    I have a function named fun1(v_fun in date), with date as an input parameter and it returns a number. I have created the function successfully. But i couldnt execute this function in sqlplus. How to pass the dates? Can any one help me in this regard.

    Hi,
    V11081985 wrote:
    HI
    I have a function named fun1(v_fun in date), with date as an input parameter and it returns a number. I have created the function successfully. But i couldnt execute this function in sqlplus. It's hard for me to say what you're doing wrong when I don't know what you're doing. Post a complete test script that people can run to re-create the problem and test their ideas. Include a function definition, CREATE TABLE and INSERT statements for any of your own tables (if necessary), and the results you want to get from that data, as well as your query.
    How to pass the dates? Can any one help me in this regard.You can call the function like this:
    SELECT  fun1 (hiredate)  AS fun1_results
    FROM    scott.emp
    ;

  • How to call a Stored Function with OUT parameter of %rowType from Java

    Hi everyone,
    I'm getting crazy trying to make this work.
    I have a function (not developed by me) in Oracle 10g declared in this way:
    type tab_RLSSP is table of TB_RLSSP_STOSTPRPAR_CL%ROWTYPE index by binary_integer;
    FUNCTION DBF_PERL_LISTA_PRATICHE (
    p_id_va IN NUMBER,
    p_seq_partita IN NUMBER,
    p_trattamento IN CHAR,
    lrec_RLSSP OUT tab_RLSSP ) RETURN NUMBER;
    And here is the code snipplet of my java method:
    sql="{? = call "+SCHEMA+PACKAGE+"."+FUNCTION_LIST+"(?,?,?,?)}";
    cs=connection.prepareCall(sql);
    cs.registerOutParameter(1, OracleTypes.NUMBER);
    cs.setLong(2,idVATitolare);
    cs.setLong(3,seqPartita);
    cs.setString(4,trattamento);// Caso Decesso
    cs.registerOutParameter(5, OracleTypes.OTHER);
    cs.executeQuery();
    result = (ResultSet) cs.getObject(5);
    if (result.next())
    listaPratiche.add(readPraticaPartita(result));
    The result (exception thrown at executeQuery with statement generated as
    SQL : {? = call PEDBA.DBK_PERL_RATEI_SUPPLETIVI.DBF_PERL_LISTA_PRATICHE(?,?,?,?)}:
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00306: wrong number or types of arguments in call to 'DBF_PERL_LISTA_PRATICHE'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Changing to :
    sql="{call ? := "+SCHEMA+PACKAGE+"."+FUNCTION_LISTA+"(?,?,?,?)}";
    leading to
    SQL : {call ? := call PEDBA.DBK_PERL_RATEI_SUPPLETIVI.DBF_PERL_LISTA_PRATICHE(?,?,?,?)}
    don't change anything.
    What's wrong? Any suggestion?
    Edited by: 957158 on 5-set-2012 9.06

    >
    Taking for granted that it works, I wonder what's different, probably the output is defined as Cursor...
    >
    You mean because of this line?
    cs.registerOutParameter(5,OracleTypes.CURSOR);You can either use a cursor or use a function that returns a SQL type instead of the PL/SQL type.
    Here is sample code using a cursor
    CREATE OR REPLACE TYPE SCOTT.local_type IS OBJECT (
        empno   NUMBER(4),
        ename   VARCHAR2(10));
    CREATE OR REPLACE TYPE SCOTT.local_tab_type IS TABLE OF local_type;
    CREATE OR REPLACE PACKAGE SCOTT.test_refcursor_pkg
    AS
        TYPE my_ref_cursor IS REF CURSOR;
         -- add more cursors as OUT parameters
         PROCEDURE   test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor);
    END test_refcursor_pkg;
    CREATE OR REPLACE PACKAGE BODY SCOTT.test_refcursor_pkg
    AS
         PROCEDURE  test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor)
         AS
            l_recs local_tab_type;
         BEGIN
             -- Get the records to modify individually.
             SELECT local_type(empno, ename) BULK COLLECT INTO l_recs
             FROM EMP;
             -- Perform some complex calculation for each row.
             FOR i IN l_recs.FIRST .. l_recs.LAST
             LOOP
                 DBMS_OUTPUT.PUT_LINE(l_recs(i).ename);
             END LOOP;
             -- Put the modified records back into the ref cursor for output.  
             OPEN p_ref_cur_out FOR
             SELECT * from TABLE(l_recs);      
             -- open more ref cursors here before returning
         END test_proc;
    END;
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
      l_cursor  test_refcursor_pkg.my_ref_cursor;
      l_ename   emp.ename%TYPE;
      l_empno   emp.empno%TYPE;
    BEGIN
      test_refcursor_pkg.test_proc (l_cursor);
      LOOP
        FETCH l_cursor
        INTO  l_empno, l_ename;
        EXIT WHEN l_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(l_ename || ' | ' || l_empno);
      END LOOP;
      CLOSE l_cursor;
    END;
    /

  • How to use LIKE function with a parameter in Oracle REPORT builder??

    how could i use parameter inside a LIKE function in Oracle reports builder?
    it works in SQL plus, but not in report builder!!
    Example:
    select code,desc from item_master where desc
    like '%&give_desc%'; ---works in SQL
    like '%:give_desc%' ---doesn't work in report builder!!

    Hi Renil,
    You will need to use the wildcard character (%) and the concatenation character (||) to join to your user parameter.
    i.e. like '%'||:give_desc||'%'
    Regards,
    John

Maybe you are looking for