Complex Calculation using sparse lookup

Hello -
I am trying to design a model such that it would give me similar result as the query below
select s.Prod_type, s.prod_code, ROUND(sum(cp.qty*(select cif.factor from index_factor cif
where cif.factor_type = 'G'
               and cif.category = s.prod_type
and cif.type_code = s.prod_code
               and cif.colour_code = s.prod_col))
* 100 /sum(cp.qty) , 0 )
from sale cp, product s where cp.product_id = s.product_id
So, in the RPD, I created a sparse lookup table to obtain the factor (col F). Created a
column A = Qty with aggregation as sum,
column B = Col F * col A
Column C = 100*Col B/Col A
In the analysis, I pull the prod type, prodcode, col A, ColB, col C, col F. When I do the aggregation at prodcode, keeping the aggregation rule as default in all the columns, at the totals I would have expected to see in
Col C= 100*sum(Col B)/sum(col A),
instead what I get is, sum(Col A) * the factor of the min colour code * 100 / sum(col A).
note: 1 prod type would have many prod code and one prod code would have many colours.
Is there any way to achieve as expected.
Thanks !!
Edited by: 958402 on 29-Nov-2012 6:43 AM

Hello !!
Any help pls !

Similar Messages

  • Need help regarding complex calculation using Max value and limiting data after Max date in MDX

    I am working on a bit complex calculated measure in SSAS cube script mode.
    Scenario /Data Set
    Date
    A
    B
    C
    A+B
    5/29/2014
    Null
    34
    Null
    34
    6/30/2014
    Null
    23
    45
    68
    7/15/2014
    25
    -25
    Null
    0
    8/20/2014
    -34
    Null
    Null
    -34
    9/30/2014
    25
    Null
    60
    25
    10/15/2014
    45
    -45
    Null
    0
    11/20/2014
    7
    8
    Null
    15
    a) Need to capture latest non-null value of Column C based on date
    with above example it should be 60 as of 9/30/2014
    b) Need to capture column A+B for all dates.
    c) Add values from column (A+B) only after latest date which is after 9/30/2014. 
    with above example it's last 2 rows and sum is 15
    d) Finally add value from step a and step c. which means the calc measure value should be = 75
    I need to perform all this logic in MDX. I was able to successfully get step a and b in separate calc measure, however i am not sure how to limit the scope based on certain date criteria. In this case it's, date> Max date(9/30/2014) . Also how should
    i add calculated members and regular members?
    I was able to get max value of C based on date and max date to limit the scope.
    CREATE MEMBER CURRENTCUBE.[Measures].[LatestC] AS
    TAIL( 
      NONEMPTY(
        [Date].[Date].CHILDREN*[Measures].[C]),1).ITEM(0) ,visible=1;
    CREATE MEMBER CURRENTCUBE.[Measures].[MaxDateofC] AS
    TAIL( 
      NONEMPTY(
        [Date].[Date].CHILDREN,[Measures].[C]),1).ITEM(0).MemberValue ,visible=1;
    Please help with Scope statement to limit the aggregation of A+B for dates > MaxDateofC? Also further how to add this aggregation value to LatestC calc measure?
    Thank You

    Hi Peddi,
    I gave TRUNC to both of the dates. But still the same issue. I think the problem is in returning the BolbDomain.
    return blobDomain;
    } catch (XDOException xdoe) {
    System.out.println("Exception in XDO :");
    throw new OAException("Exception in XDO : "+xdoe.getMessage());
    catch (SQLException sqle) {
    System.out.println("Exception in SQL :");
    throw new OAException("SQL Exception : "+sqle.getMessage());
    catch (OAException e) {
    System.out.println("Exception in OA :");
    throw new OAException("Unexpected Error :: " +e.getMessage());
    Thanks and Regards,
    Myvizhi

  • Using Dense/Sparse Lookup on Tables or files from different Databases

    Hi,
    I have a Subject Area which is built on Essbase cube. I have a requirment where I have to use a Lookup on Flat file and/or Database Table.
    I followed below steps
    1. Created a Logical Column in BMM Layer for a cube dimension
    2. Opened the LTS Properties --> Column Mapping and gave below formula
    Lookup(SPARSE "Function1"."E:\502125500".""."Function2.txt"."ALIAS", 'NA', "TNWD06613.genpitfi01.og.ge.com"."GOGREP".""."GOGREP"."Gen5,Functions" )
    where
    Function1"."E:\502125500".""."Function2.txt"."ALIAS" ---> Column from File (Created File DSN and imported in RPD)
    "TNWD06613.genpitfi01.og.ge.com"."GOGREP" ---> Essbase Cube
    3. Dragged the Column to Presentation for Subject Area on Cube
    When I try to create a report on this column I get below error.
    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: 16001] ODBC error state: 22005 code: -3030 message: [Microsoft][ODBC Text Driver] Expression too complex. [nQSError: 16015] SQL statement execution failed. (HY000)
    SQL Issued: SELECT 0 s_0, "Essbase Test"."Functions"."Alias" s_1, "Essbase Test"."Functions"."Gen5,Functions" s_2, SORTKEY("Essbase Test"."Functions"."Gen5,Functions") s_3 FROM "Essbase Test" FETCH FIRST 65001 ROWS ONLY
    Can anybody help me on the same?

    You can script schemas from all DBs and in case of conflicts you will have to decide what to do.
    For example if you have the same SP or UDF on two DBs that does different things, you need to decide what to do with them.
    Only if the conflict is tables with the same structure and without KEY constraints and you can also script data and go on.
    If you have PK-FK relationships (which I bet is the case) you really need to design your changes based on them and I suspect you will end up scripting instead of putting boxes on SSIS.
    It really is a migration job for an experienced DBA and am afraid SSIS can do that much as
    Integrate.. not Migrate.

  • Using a sparse lookup with a date range?

    Hey all,
    I have created a table (Benchmark_Lookup) that contains the following columns:
    start_date, end_date, section, benchmark
    I then have numerous logical tables (Eg Business Growth) that will all have a new logical column performing a sparse lookup on the above table to retrieve it's benchmark value.
    In the lookup table, I have multiple rows for the same section with different benchmarks differentiated by the date range that they were in effect.
    I have worked out how to perform this lookup using the following:
    lookup(SPARSE "bla".Benchmark_lookup"."Benchmark" ,0, "bla"."Business_Growth"."section")
    Unfortunately, the above is now bringing back duplicates as it's not working out what date range to select from.
    I have joined the lookup table (using a physical join) to my Time dimension by saying "business_date >= start_date and business_date <= end_Date" but that doesn't seem to work.
    Any ideas?

    Hi there,
    Neither of these examples help that much.
    I understand how the lookup function works but what happens if the lookup table has the following two rows:
    EFFECTIVE_FROM     EFFECTIVE_TO     SECTION     SCORE
    01/Jan/1900                 30/Jun/2013           test              1
    01/Jul/2013                  06/Jun/2079           test              2
    I need to use the following lookup rules:
    Business_Date >= Effective_From
    Business_Date <= Effective_To
    Section = 'Test'
    The lookup should therefore only ever return one row as the date is used to find the appropriate range.

  • Use of Lookup Files in BI Applications

    Hi,
    Can any one tell the use of lookup files in BI Applications. While doing the configurations (for all modules) for these lookup files we get the data from the ERP database tables using the query provided by oracle and populate the file and then map with some domain values.
    Why cant we directly populate the datawarehouse tables using the ERP tables instead of populating through the lookup files (which we any how populate with ERP tables). Also what is the use of domain values. Does these use in reporting puposes and anlyzing the data or business.
    Thank You,

    For e.g, when you map the GL group account numbers, the predefined group codes such as 'CASH', 'AR', 'AP' , 'TAX' etc are the domain values. In the repository, the metrics are defined based on these domain values.
    Say, you mapped your CASH accounts from 0011 through 0100, then OBIEE calculates the metrics related to CASH as summation (or some kind of calculation) on the accounts that have the group codes (domain values) as CASH.
    It should be possible to update the domain values directly from ERP database tables but the ETL expects the mapping to be in files. Also in some cases we cannot change the default domain values, all we can change is the mapping to these domain values or create new domain values. At one client, we had to create a new account group code called 'FIXED ASSET' as the default domain values were not sufficient but then we had to change the repository to include new metrics and change existing ones to incorporate this new group code.
    -Nilesh
    http://www.appsbi.com

  • How do I write JavaScript for a complex calculation in a PDF?

    Is there a way to create a more complex calculation in a PDF? I have created an order form that has separate fields for quantity, price and subtotals. For every item on the order form, the first two quantities are no charge. Each quantity after that is .25/each. How do I write the JavaScript to accomplish this calculation?
    e.g. 6 items ordered, first 2 are No Charge,
    =(2*0.00)+(Qty-2*0.25), should equal $1.00
    =(2*0.00)+(6-2*0.25)
    =0.00+1.00
    =1.00

    Not quite. You still need to use the eval function otherwise the numbers are just strings.
    Try this in the JavaScript Debugger:
    var Qty = 4;
    if (Qty>2) {
        var subtotal = eval ((Qty-2)*0.25);
    } else {
        var subtotal = 0;
    app.alert (subtotal);
    Steve

  • Did it possible To do Sparse Lookup in ODI as Informatica/ Datastage ?

    Hi,
    In ODI, Lookup is new concept is introduced anyone implemented it ? Can I know how to do it?
    Sparse Lookup could be possible in ODI? How can i should be done?
    I am learning ODI 11g new concepts..Can any one implement this please guide me how to implement it?
    If Anyone Implemented ODI 11g partitions.union...some other please share it it is so useful for how are upgrading the new concepts.
    Thanks in advance.Hope to post the Implememtations of ODI 11g concepts

    a friend told me that he wants my os x cd for my macbook pro to upgrade his imac.
    The discs that come with your Mac are "machine specfic" and cannot be used on another Mac.

  • Sap Query sq01: how to combine substrings in complex calculations

    I made a query with sap query. I made 1 local field: name1. I have 2 fields firstname and lastname and a field named class.
    In the complex calculations screen I made the following calculation for that field:
    Condition: CLASS='1'
    Formula: firstname' 'lastname
    When I try to run this query I get an Abap error saying "unable to interpret [firstname] as a number". It looks like the + expression can only be used here for numeric calculations.
    Does anyone know how to solve this?
    Edited by: J S on Jan 27, 2009 11:52 AM

    Hi,
    i think its better to concatenate in the infoset code section.... you create a local filed in infoset of type char and then write the concatenate statement of abap and keep first name and last name in the local field .... write this code in the record processing section and take this local filed and display it in the  query i think this clears you ..
    by the way if you still want any information let me know

  • Running complex calculations

    Hi all
    My question has 2 parts
    1) I will need to run a rather complex calculation which involves searching through a rather large dimension (30000 members) and using an allocation % unique to each member, allocate that percentage to other members. So my questions are 1) would this be better in a BSO or ASO cube (my guess is BSO)
    and 2) seeing as the cube will have 10 dimensions and (as I stated earlier) 3 of the dimensions will have large numbers of members, will this calc be time intensive? (I know there are other variables such as server size and speed etc, but I am just looking for a ball park guess right now)
    We are currently using version 11 essbase.
    As always thanks for your expertise

    Hi,
    have you checked the default trace? Do you get a timeout error from the backend? Maybe the calculation is too complex and the iView times out.
    Anja

  • Could not access Local Session Bean using JNDI lookup

    Hi EJB Guru,
    I am quite new to EJB 3.0 but have had a good deal of success including using JNDI to lookup Remote Stateless Session Bean in EJB 3.0. However, looking up local Stateless Session Bean prove more challenging with I had anticipated.
    Here is my code
    as follows:
    public interface Calculator {
        public int add(int x, int y);
        public int subtract(int x, int y);
    import javax.ejb.Remote;
    @Remote
    public interface CalculatorRemote extends Calculator {
    import javax.ejb.Local;
    @Local
    public interface CalculatorLocal extends Calculator {
    import javax.ejb.Local;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import bean.CalculatorLocal;
    import bean.CalculatorRemote;
    @Stateless
    public class CalculatorBean implements CalculatorRemote, CalculatorLocal {
        public int add(int x, int y) {
            return x + y;
        public int subtract(int x, int y) {
            return x - y;
    import bean.*;
    import bean.Calculator;
    import bean.CalculatorLocal;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public class ClientAccessLocalCalculator {
        public static void main(String[] args) throws NamingException {
            InitialContext ctx = new InitialContext();
            CalculatorLocal calculator = (CalculatorLocal) ctx.lookup("CalculatorBean/local");
            System.out.println("1 + 1 = " + calculator.add(1, 1));
            System.out.println("1 - 1 = " + calculator.subtract(1, 1));    }
    import bean.Calculator;
    import bean.CalculatorRemote;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public class ClientAccessRemoteCalculator {
        public static void main(String[] args) throws NamingException {
            InitialContext ctx = new InitialContext();
            CalculatorRemote calculator = (CalculatorRemote) ctx.lookup("CalculatorBean/remote");
            System.out.println("1 + 1 = " + calculator.add(1, 1));
            System.out.println("1 - 1 = " + calculator.subtract(1, 1));    }
    }Output when running ClientAccessRemoteCalculator gives
    1 + 1 = 2
    1 - 1 = 0
    Output when running ClientAccessLocalCalculator on JBoss AS 4.0.5 gives:
    Exception in thread "main" javax.ejb.EJBException: Invalid invocation of local interface (null container)
    at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:75)
    at $Proxy0.add(Unknown Source) at ClientAccessLocalCalculator.main(ClientAccessLocalCalculator.java:14)
    JNDIView in JMX-Console in JBoss:
    +- CalculatorBean (class: org.jnp.interfaces.NamingContext)
    | +- local (proxy: $Proxy84 implements interface bean.CalculatorLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
    | +- remote (proxy: $Proxy83 implements interface bean.CalculatorRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
    Output when running ClientAccessLocalCalculator on SJSAS 9.0 gives:
    Exception in thread "main" javax.naming.NameNotFoundException: bean.CalculatorLocal not found
    C:\>asadmin
    Use "exit" to exit and "help" for online help.
    asadmin> list-jndi-entries
    Jndi Entries for server within root context:
    bean.CalculatorRemote: javax.naming.Reference
    jbi: com.sun.enterprise.naming.TransientContext
    jdbc: com.sun.enterprise.naming.TransientContext
    UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
    bean.CalculatorRemote__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
    bean.CalculatorRemote#bean.CalculatorRemote: javax.naming.Reference
    ejb: com.sun.enterprise.naming.TransientContext
    Command list-jndi-entries executed successfully.
    asadmin>I am using Application Client to lookup these Session Beans on Netbeans 5.5, JBoss AS 4.0.5 (EJB3 installer)/SJSAS
    9.0, SDK 1.5.0_11 on Windows XP platform.
    Any assistance would be much appreciated.
    Many thanks,
    Henry

    Hi Henry,
    Any direct global JNDI lookup is not portable. It works in some cases but not in others, which
    is why we recommend using the portable Java EE approach of declaring an ejb dependency
    and looking up that dependency via the bean's component environment (java:comp/env).
    This is true whether you're dealing with Remote or Local ejb dependencies.
    Local ejbs are not supported in the Application Client tier at all. In the server tier, there is no
    guarantee that a Local EJB even is assigned a global JNDI name since there's no requirement
    that it be available outside of the application in which the ejb is defined.
    You can find more information on these ejb access topics in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • How to use JDBC Lookup in PI 7.1 ?

    Hi,
    Please advise how to use JDBC lookup in message mapping PI 7.1 ? any reference link / document  ?
    I have followed this step below :
    1. Create the external definition for the database table.
    2. Use the external definition (table) in message mapping JDBC Lookup.
    But the target still "Yellow colour" meanint the mapping hasnot completed yet ? why ? and when i double click the JDBC lookup
    there some error message
    "No suitable parameter found; define new parameter of type 'Channel' first"
    Please advise.
    Thank You and Best Regards
    Fernand

    Hi Fernand,
    JDBC Lookup can be done in PI 7.1 using below mentioned steps :
    1) Create a communication channel between PI and the database to connect to database.
    2) Import the table data as External Definition.
    3) In message mapping where this lookup is to be used select JDBC Lookup under Conversions and map
    4) Double Click on JDBC Lookup
    5) Select parameter and a database table (imported as the external definition). All the elements of the table will appear in the middle column. Select and move the input parameters to the left side column and the output parameters to the right side column. Click OK. 
    6) Under message mapping go to signature tab and define the parameter as channel and category as JDBC Adapter Type. 
    7) Under Operation mapping define the parameter & associate it with parameter defined in Message Mapping.
    Thanks
    Amit

  • Complexity of using N-step BADI in SRM 7using Process controlled Workflow.

    Hi,
    Just as a big thought,
    I have a Shopping Cart requirement, Here i am asked to develop a Custom workflow for SRM 7.0.
    And the client is looking for us to use Process Control Workflows i.e(BRF integrated one).
    I need to understand the complexity of using a N-step BADI.
    How would be the complexity level if I use a N step BADI( ie Multiple approval levels on Line Item Based).
    Kindly tell me the complexity of Using it and if any one has come across some requirement like this, then explain me that how did you face the situation.
    Expecting an Earliest Response.
    Thanks,
    Shanky

    Hi,
      Is your project SRM 7.0 implementation project then you have to go for Process Controlled Workflow and if your project is upgrade then you can still go with Application Controlled Workflow but down line this has to switch to Process Controlled Workflow.
    Best Regards,
    Saravanan

  • How to use two lookup in single interface in ODI 11g

    Hi All,
    I am trying to load GL_CODE_COMBINATIONS CC + FND_FLEX_VALUES_VL FF to target table W_GL_CODE_COMBINATIONS.
    I duplicated FND_FLEX_VALUES_VL as FND_FLEX_VALUES_VL1 FF1 for my join condition.
    In target table I have included 2 new columns named SEGMENT2_DESC and SEGMENT3_DESC.
    In my interface i am using FND_FLEX_VALUES_VL as lookup and join condition is CC.SEGMENT2=FF.FLEX_VALUE
    Mapping expression of target column SEGMENT2_DESC is FF.DESCRIPTION.
    In my interface i am using FND_FLEX_VALUES_VL1 as lookup and join condition is CC.SEGMENT3=FF1.FLEX_VALUE
    Mapping expression of target column SEGMENT3_DESC is FF1.DESCRIPTION.
    Execution of this interface taking more time. When using single lookup and SEGMENT2_DESC data loading is fast.
    Kindly advice me regarding this.
    Thanks in advance.

    Are the number of records in lookup very large ?
    Why cant you use the same lookup once and have the join containing both the conditions.
    YOu dont have to use lookup at all. YOu can also drag the "so called" lookup table in the source and build the join conditions yourself.
    The join condition would be
    CC.SEGMENT2=FF.FLEX_VALUE and CC.SEGMENT3=FF.FLEX_VALUE

  • What is the use of lookup tranformation in odi

    Hi Experts,
    What is the use of lookup transformation in ODI.
    In ODI we use different kinds of joins, so my doubt is what is the difference between lookup transformation joins and normal joins we use in ODI.
    Please let me know with your valueable information.
    Thx,
    Sahadeva.

    Use the SIM card to connect to the cell carrier 3G network when there is no wifi available.
    To set it up, see this -> http://support.apple.com/kb/HT4157

  • Designing a calculator using selection screen(abap)

    hi i just now stepped into this technology. iam learning abap.  i like to jknow how to design a calculator using selection screen. 
    could any one give your  suggestions or any sites having such example programs . 
    thankyou

    Hi
    Welcome to SDN.
    Use the sample peace of code for design Calculator.
    Hi,
    Create push buttons for the + , - , / , * , = in your dialog program.
    Create an input field with the data type that can accept decimal places..
    When the enter 12 then press the push button "+" button store the value 12 in a variable v1..Then clear the input field..
    Then when the user enters another number..lets say "13"..
    Then if the user presses the "=" button...Then sum the values from the variable v1 with the input field..
    Hope this helps..
    Check this sample code..
    MODULE USER_COMMAND.
    CASE SY-UCOMM.
    WHEN 'ADDITION'.
    ASSUMING THE INPUT FIELD NAME IS P_INPUT.
    V_V1 = P_INPUT.
    V_OPERATION = '+'.
    CLEAR: P_INPUT.
    WHEN 'EQUALTO'.
    CASE V_OPERATION.
    ADDITION
    WHEN '+'.
    SUM UP THE VALUES.
    P_INPUT = P_INPUT + V_V1.
    ENDCASE.
    MULTIPLICATION
    WHEN '*'.
    MULTIPLY UP THE VALUES.
    P_INPUT = P_INPUT * V_V1.
    ENDCASE.
    ENDCASE.
    ENDMODULE.
    Regards,
    Sree

Maybe you are looking for