Calculating percent of total

Hello, everyone
I have the following simple business question at hand: Show top ten merchants with the highest sales numbers in the region and their percentages of total sales in the region.
It looks simple, but I'm not sure if it's possible to implement in OBIEE short of writing direct query.
I would really appreciate some ideas because I am out of those at the moment.
I am using OBIEE 10 over Oracle 10g.
Thank you,
Rita

Perfect! Thank you, David, this is exactly what I was looking for - how to calculate higher-level aggregates in a request. Is there any documentation on the OBIEE logical SQL, or these forums are the only source of information?

Similar Messages

  • Calculation based on totals in Crosstab

    Hi,
    I have the following crosstab.
    Vendor 1234
         Dc Nbr 1     2     4     
    Sum Invoice Amt      1387.04     300.82     327.29     2015.15
    Sum Cost 44.86 57.43     25.54     127.83
    Sum Advanced Cost     102.44     0     0     102.44
    Sum Consolidation Cost     30.37     0      0     30.37
    Sum Allowance Amt     27.74     6.02     6.54     40.30
    Net Freight Cost     149.93 51.41     19     220.34
    Freight Percent     10.81     17.09     5.81     ****
    The last column are Row totals for those fields.
    What I need is how to get the **** to be 10.93 which is the Freight Percent calculation value based on the Total Column fields. The
    Frieght Percent field is calculated as follows for the rows.
    ( NVL(Sum Cost,0)+NVL(Sum Advanced Cost,0)+NVL(Sum Consolidation Cost,0)-NVL(Sum Allowance Amt,0) )/NVL(Sum Invoice Amt,0)*100                         
    I have tried to do the Row Total with Average, Sum, etc, but not getting the answer we need.
    Table structure is 3 rows per vendor with 1 row per dc nbr.
    Any help would be greatly appreciated.
    Thanks
    Edited by: clifford_d on Dec 4, 2008 9:46 AM

    See if this explains it better for my crosstab with page items of Vendor Number 1234.
    Vendor 1234
    Dc Nbr 1 2 4 AAAA
    Sum Invoice Amt 1387.04 300.82 327.29 2015.15
    Sum Cost 44.86 57.43 25.54 127.83
    Sum Advanced Cost 102.44 0 0 102.44
    Sum Consolidation Cost 30.37 0 0 30.37
    Sum Allowance Amt 27.74 6.02 6.54 40.30
    Net Freight Cost 149.93 51.41 19 220.34
    Freight Percent 10.81 17.09 5.81 ****
    As stated before, Frieght Percent is a calculation I created in Discoverer that looks like this :
    ( NVL(Sum Cost,0)+NVL(Sum Advanced Cost,0)+NVL(Sum Consolidation Cost,0)-NVL(Sum Allowance Amt,0) )/NVL(Sum Invoice Amt,0)*100
    Column AAAA was created in Discoverer using Sum of field and show to the right.
    What I need is for the **** to be the correct calculation for the totals in column AAAA. If I use do a total for Freight Percent using the Cell Sum I get 33.70., what I want is it to be 10.93, which is (127.83 + 102.44 + 30.37 - 40.30)/2015.15*100.
    If I use an Average Total row for Freight Percent, I get 11.24 which is 33.70 / 3 (the 3 would be the # of dc nbr's)
    I did start with using the detail level data to create this crosstab. Then I made a new version and used the SUM data. I seem to get the same results but am still having issues with the one **** value.
    Hopefully this explains it better.
    Thanks for the ideas so far.

  • Calculating discounts on total PO and not excluding unplanned cost

    Hi friends,
    when User does MIRO they enter unplanned frieght cost in the gl account tab.
    Lets say P.O. is 500 freight is 100 total miro document will be $ 600 .
    Now when we pay to the vendor it calculates discount on the total amount[600] and not excluding Freight.
    We did check the "Indicator: Line item not liable to cash discount?" and even though its calculating on the total amount.
    Is there anything else we are missing?
    Please advise

    Hi Sina
    in addition what Anthony has said, you either have planned costs or unplanned costs:
    for example: If you put freight costs in the PO item when you create the PO then you have planned delivery costs, and those will be accounted when you carry GR on a clearing account which is cleared on invoice receipt.
    in the case you don't mention the costs at PO creation, then you put the costs in the details tab, in the appropriate field Unplanned costs.
    Depending on how you have setup in customizing how this cost is managed, they either distribute proportionally between the invoice items( and will be put on a stock account in case of moving average price, or on a price difference account in case of a standard price), or they are put on a seperate GL account).
    Regards
    Sidi

  • Percent of total and percent of completion?

    would anyone mind helping me with which equations to use for a "percent of total" and percent of completion equations?
    i have a total amount and i would like to list the various items that make up this total in chronological order so i can see the percentage in percentage and in actual dollars but also as a "percent completion" in percentage and in real dollars.
    i am envisioning something like this for percent - percent completion - dollars per item - dollars per completion
    line 1     1%          1%               $1          $1
    line 2      2%          3%               $2          $3
    line 3     97%          100%          $97          $100
    total      100%                           $100
    i am a little new to this so any suggestions will help a great deal.
    THANKS

    hi barry.
    thank you.
    i have a construction budget with - say - 18 items. these 18 items go chronologically from start to finish for the construction. i would like to show what percentage of the total budget each item is (percent of total dollars i guess) but i would also like to sum up the "percent completed" for each line item so that when you looked at the results for - say line 8 - you could see that you were X% completed for the whole project in terms of the total dollars allotted for the whole project (100%).
    what i was envisioning was that it would be possible to do this both in terms of a number for the /percent/ of each of these but also in terms of a /dollar/ amount for each of these.
    one set would be the individual line item and the other set would be added up as you went down the list and completed the work.
    THANKS

  • Percent of Total

    Has any one figured out how to create a Percent of Total Member Dynamic Calc that could keep track of the Percent of Total without doing this in the reporting tool?For Example: ACT Percent of TotalCookies Jan 10 %10 Feb 20 %20 Mar 70 %70 2001 100 %100

    Presuming that Actual is a member of the Scenario dimension and that Total Cookies is a dimension, I would probably create another member in the Scenario dimension and put the following formula against it:Actual%Actual->"Total Cookies";This would have to be dynamic calc to work.

  • AWM Calculated Measure for Percent of Total Across Multiple Dimensions?

    I noticed that AWM has a Share function that gives me a percent total of a grain from a specific hierarchy's Top of Hierarchy, but is there any way to do that with multiple dimensions? For example, if I had a Share of Dimension X = 55% Where Time = 1/1/2013 and a Share of Dimension Y = 32% Where Time = 1/1/2013, then could I have a Share of both Dimension X and Dimension Y = 16% Where Time = 1/1/2013?

    I had used an alternate solution which is a bit more cumbersome using native OLAP_DML formulae/expression.
    The above expression using OLAP Expression Syntax is much better (if it works).
    I was not aware of this OLAP expression syntax when i needed to create a kpi for similar requirement.
    We had Qty measure and Share along dimension like "Qty - Share at Year level", "Qty - Share of Total Customer".
    We needed to get "Qty - Share at Total Customer, Year".
    Cube= SALESCUBE
    Base Meas = QTY
    Step 1) Create Measure which represents "Qty - Total Customer, Year" which will work in any reporting context ...
    Note: For time=day1/2/3/ within same year and customer=cust1/2/3/... or Total Customer, the expression result will be constant (result fixed for any dimension members/status along the 2 dimensions - TIME and CUST). Denominator Value changes each year since we have constrainted time dimension to the ancestor of current cell at YR level. If we choose anscestor at TOP level TOTTIME say then the value is fixed for all time dimension members/values.
    olap dml expression: QUAL(SALESCUBE_QTY, CUSTOMER limit(CUSTOMER to CUSTOMER_LEVELREL 'TCUST'), TIME limit(limit(TIME to ANCESTORS USING TIME_PARENTREL TIME(TIME TIME)) KEEP TIME_LEVELREL eq 'YR'))
    in awxml - this becomes:
    ETMeasureColumnName="QTY_TCUST_YR"
    Name="QTY_TCUST_YR"
    MeasureExpression="OLAP_DML_EXPRESSION('QUAL(SALESCUBE_QTY, CUSTOMER limit(CUSTOMER to CUSTOMER_LEVELREL ''TCUST''), TIME limit(limit(TIME to ANCESTORS USING TIME_PARENTREL TIME(TIME TIME)) KEEP TIME_LEVELREL eq ''YR''))', NUMBER)">
    <Classification
    Value="AwmDescriptionType=OLAP_DML_CALC"/>
    <Description
    Type="LongDescription"
    Language="AMERICAN"
    Value="Qty - Total Customer, Year">
    Step 2) Define the share measure explicitly since we have already calculated the denominator needed for composite share.
    Check for division by 0 error before performing the share calculation explicitly as Numerator= Qty (for current cell/reporting context) and Denominator = Qty - Total Customer, Year (from Step 1)
    olap dml expression: if SALESCUBE_QTY_TCUST_YR ne 0 then SALESCUBE_QTY / SALESCUBE_QTY_TCUST_YR else na
    in awxml - this becomes:
    ETMeasureColumnName="QTY_SHARE_TCUST_YR"
    Name="QTY_SHARE_TCUST_YR"
    MeasureExpression="OLAP_DML_EXPRESSION(&apos;if SALESCUBE_QTY_TCUST_YR ne 0 then SALESCUBE_QTY / SALESCUBE_QTY_TCUST_YR else na&apos;, NUMBER)">
    <Classification
    Value="AwmDescriptionType=OLAP_DML_CALC"/>
    <Description
    Type="LongDescription"
    Language="AMERICAN"
    Value="Qty - Share of Total Customer, Year">
    </Description>
    Report needs to use measure QTY_SHARE_TCUST_YR (Qty - Share of Total Customer, Year) defined in Step 2. It may be useful to expose/display intermediate measure QTY_TCUST_YR also so as to make the basis of calculation very clear to the user.
    Nick,
    If you customize above soln. to use Total Time, Total Prod and Total Organization (along 3 dimensions)... I am sure the fact table has a time dimension which should also be factored in in your calc/defn.
    If you have missed out the join to Time dimension from fact in your queries, in olap reporting terms, its similar to Time Dimension selection of Time level = TTIME Total Time (1 node at TOP).
    You need:
    Step 1) Qty - Total Time, Total Product and Total Org
    Step 2) Qty - Share of Total Time, Total Product and Total Org
    Then the example you gave should be covered via QTY and QTY_SHARE_TTIME_TPROD_TORG (Step 2)
    SUM(quantity)
    2875should be QTY, QTY_SHARE_TTIME_TPROD_TORG (=100%) at Time level = TTIME, Product level = TPROD, Org level = TORG
    SUM(quantity)
    345 [12% of all products sold]should be QTY, QTY_SHARE_TTIME_TPROD_TORG (=12% hopefully) at Time level = TTIME, Product level = PROD with report filter on product = 'CX-867054', Org level = TORG
    SUM(quantity)
    977 [34% of all products sold]should be QTY, QTY_SHARE_TTIME_TPROD_TORG (=34% hopefully) at Time level = TTIME, Product level = TPROD, Org level = STORE with report filter on store = 'NY_ALBA_013'
    SUM(quantity)
    88 [3.06% of all products sold]should be QTY, QTY_SHARE_TTIME_TPROD_TORG (=3.06% hopefully) at Time level = TTIME, Product level = PROD with report filter on product = 'CX-867054', Org level = STORE with report filter on store = 'NY_ALBA_013'
    HTH
    Shankar

  • Calculating Percent totals and Averages in SSRS

    Below is a report created using SSRS. I want to be able to calculate the percentage(%) total to add up to 100 % in the Total column. For some reason my averages are not working as you can see from the table. The idea is to calculate the averages of opportunities
    as well as Sold. But from my calculation, things are not adding up as I supposed. This report is not grouped by parent. How do I make this to work as it should? Thank you.
    (NB: Please zoom in to view the image)
    Zionlite

    Hi,
    According  to the description, I doubt you may manually add Total and Averages columns. Did you manually add Local and International or they were in a column group?
    You can use the following expression for the Opportunity Cost(averages) column in the total row:
    =Sum(Fields!opportunitycost.Value)/2
    How did you calculate the percentage column? If it is Sold value divided by Opportunity Cost value, use:
    =Sum(Fields!sold.Value)/Sum(Fields!opportunitycost.Value)
    Also try to define the scope in the expression and see if it make difference.
    If there is no progress, please capture the screenshot of your design tab.(Click on the report and capture the image of your report structure)
    Also, tell us the expression of the text box which in problem.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • % of calculation in GRAND TOTAL in PIVOT TABLE

    Hi Gurus,
    I have a requirement to calculate the percentage based on the grand total in pivot table,but in row wise i am getting the percentage while in grand total level i am not getting correct values.I have tried with all the options like:average,Sum,Default,Max,Min,count etc and also with the percent of row,column,parent column etc.
    Please give me a solution for this ASAP.
    view of my table is
    Previous Value||Present Value||change between Pres & Prev||% of change(((pres - prev)/pres)*100)
    10||20||10||50%
    00||01||01||100%
    10||05||-05||-50%
    here i should get values in grand total like
    20||26||06||23%
    but i am getting values when giving sum for %of calc in measures values
    20||26||06||100%
    if i give avg for %of calc in measures values then i am geting
    20||26||06||33%
    how to solve this prob.Can any one give sol plzzzzzzzz
    Thanks,
    Naveen

    Hi,
    Refer : http://www.skurabigroup.com/blog/?p=579
    Regards,
    Srikanth

  • [10g/8i] Need help calculating a hierarchical total

    Hi all...
    I am trying to determine the total quantity of each unique part number in a bill of materials (big list of parts that go into a final product). The total needs to take into account the quantity of the parent parts--what I mean by this is, if you have final product 'A' that takes 1 x part 'B' and 2 x part 'C', and part 'C' takes 1 x part 'B' and 3 x part 'D' then the totals of all unique parts in product 'A' would be: 3 x B, 2 x C, 6 x D.
    It would be nice if this query ran under 8i, but if it's much more complex than the equivalent query for 10g, don't worry about making it work for 8i.
    Here is some sample data:
    CREATE TABLE     BOM
    (     part_nbr     CHAR(25)
    ,     bill_seq     VARCHAR2(140)
    ,     bill_level     NUMBER
    ,     parent_part     CHAR(25)
    ,     line_nbr     NUMBER(5)
    ,     child_part     CHAR(25)
    ,     qty_per          NUMBER(9,5)
    INSERT INTO BOM VALUES ('12345-1','   10019970303',1,'12345-1',100,'12345-76',1);
    INSERT INTO BOM VALUES ('12345-1','   20019970303',1,'12345-1',200,'12345-272',1);
    INSERT INTO BOM VALUES ('12345-1','   30019970303',1,'12345-1',300,'12345-267',1);
    INSERT INTO BOM VALUES ('12345-1','   30019970303   10019830901',2,'12345-267',100,'12345-268',1);
    INSERT INTO BOM VALUES ('12345-1','   30019970303   10019830901   10019830901',3,'12345-268',100,'12345-268-1',1);
    INSERT INTO BOM VALUES ('12345-1','   30019970303   20019830901',2,'12345-267',200,'12345-269',1);
    INSERT INTO BOM VALUES ('12345-1','   30019970303   30019830901',2,'12345-267',300,'12345-270',1);
    INSERT INTO BOM VALUES ('12345-1','   30019970303   40019830901',2,'12345-267',400,'HARDWARE-4',1);
    INSERT INTO BOM VALUES ('12345-1','   30019970303   50019830901',2,'12345-267',500,'HARDWARE-5',1);
    INSERT INTO BOM VALUES ('12345-1','   40019970303',1,'12345-1',400,'HARDWARE-6',2);
    INSERT INTO BOM VALUES ('12345-1','   50019990824',1,'12345-1',500,'A12345-475',1);
    INSERT INTO BOM VALUES ('12345-1','   60019970303',1,'12345-1',600,'HARDWARE-7',1);
    INSERT INTO BOM VALUES ('12345-1','   70019990824',1,'12345-1',700,'A12345-476',1);
    INSERT INTO BOM VALUES ('12345-1','   70019990824   10019990824',2,'A12345-476',100,'A12345-476-1',1);
    INSERT INTO BOM VALUES ('12345-1','   80019970303',1,'12345-1',800,'12345-222',1);
    INSERT INTO BOM VALUES ('12345-1','   90019970303',1,'12345-1',900,'12345-157',1);
    INSERT INTO BOM VALUES ('12345-1','   90019970303   10119980922',2,'12345-157',101,'RAW-2',6.2);
    INSERT INTO BOM VALUES ('12345-1','  100019990215',1,'12345-1',1000,'A12345-494',2);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   10019990216',2,'A12345-494',100,'A12345-486',1);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   10019990216   10019000101',3,'A12345-486',100,'12345-158',1);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   10019990216   10019000101   10119960118',4,'12345-158',101,'RAW-3',6.75);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   10019990216   10120000317',3,'A12345-486',101,'RAW-3',6.75);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   20019970303',2,'A12345-494',200,'12345-155',1);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   30019970303',2,'A12345-494',300,'12345-266',1);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   40019990215',2,'A12345-494',400,'A12345-493',1);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   50019970303',2,'A12345-494',500,'HARDWARE-8',1);
    INSERT INTO BOM VALUES ('12345-1','  100019990215   60019970303',2,'A12345-494',600,'HARDWARE-9',1);
    INSERT INTO BOM VALUES ('12345-1','  110019970303',1,'12345-1',1100,'HARDWARE-10',1);
    INSERT INTO BOM VALUES ('12345-1','  120019970303',1,'12345-1',1200,'HARDWARE-9',1);
    INSERT INTO BOM VALUES ('12345-1','  130019970303',1,'12345-1',1300,'HARDWARE-11',2);
    INSERT INTO BOM VALUES ('12345-1','  140020000228',1,'12345-1',1400,'HARDWARE-12',1);
    INSERT INTO BOM VALUES ('12345-1','  150020000228',1,'12345-1',1500,'HARDWARE-13',2);
    INSERT INTO BOM VALUES ('12345-1','  160020000228',1,'12345-1',1600,'HARDWARE-14',2);
    INSERT INTO BOM VALUES ('12345-1','  170020000228',1,'12345-1',1700,'12345-250',8);
    INSERT INTO BOM VALUES ('12345-1','  180020000228',1,'12345-1',1800,'FLUID1',0.00001);
    INSERT INTO BOM VALUES ('ABC-123','   10019000101',1,'ABC-123',100,'ABC-123-1',1);
    INSERT INTO BOM VALUES ('ABC-123','   10019000101   10019000101',2,'ABC-123-1',100,'AYZ-1',2);
    INSERT INTO BOM VALUES ('ABC-123','   10019000101   10019000101   10019000101',3,'AYZ-1',100,'AYZ-2',1);
    INSERT INTO BOM VALUES ('ABC-123','   10019000101   10019000101   10019000101   10019000101',4,'AYZ-2',100,'RAW-1',1);
    INSERT INTO BOM VALUES ('ABC-123','   10019000101   10019000101   20019000101',3,'AYZ-1',200,'HARDWARE-1',10);
    INSERT INTO BOM VALUES ('ABC-123','   20020001110',1,'ABC-123',200,'HARDWARE-2',15);
    INSERT INTO BOM VALUES ('ABC-123','   30020001121',1,'ABC-123',300,'HARDWARE-1',26);
    INSERT INTO BOM VALUES ('ABC-123','   40019000101',1,'ABC-123',400,'AYZ-25',1);
    INSERT INTO BOM VALUES ('ABC-123','   50020001121',1,'ABC-123',500,'HARDWARE-3',5);Here are the results I expect (I don't care about the order, this is just the order I hand-calculated the results in):
    PART_NBR    CHILD_PART  TOTAL_QTY  
    ABC-123     ABC-123-1   1          
    ABC-123     HARDWARE-1  46         
    ABC-123     HARDWARE-2  15         
    ABC-123     HARDWARE-3  5          
    ABC-123     RAW-1       1          
    ABC-123     AYZ-1       2          
    ABC-123     AYZ-2       2          
    ABC-123     AYZ-25      1          
    12345-1     12345-155   1          
    12345-1     12345-157   1          
    12345-1     12345-158   2          
    12345-1     12345-222   1          
    12345-1     12345-250   8          
    12345-1     12345-266   1          
    12345-1     12345-267   1          
    12345-1     12345-268   1          
    12345-1     12345-268-1 1          
    12345-1     12345-269   1          
    12345-1     12345-270   1          
    12345-1     12345-272   1          
    12345-1     12345-76    1          
    12345-1     A12345-475  1          
    12345-1     A12345-476  1          
    12345-1     A12345-476-11          
    12345-1     A12345-486  2          
    12345-1     A12345-493  1          
    12345-1     A12345-494  2          
    12345-1     FLUID1      0.00001    
    12345-1     HARDWARE-10 1          
    12345-1     HARDWARE-11 2          
    12345-1     HARDWARE-12 1          
    12345-1     HARDWARE-13 2          
    12345-1     HARDWARE-14 2          
    12345-1     HARDWARE-4  1          
    12345-1     HARDWARE-5  1          
    12345-1     HARDWARE-6  2          
    12345-1     HARDWARE-7  1          
    12345-1     HARDWARE-8  1          
    12345-1     HARDWARE-9  2          
    12345-1     RAW-2       6.2        
    12345-1     RAW-3       27          Clearly this query:
    SELECT     part_nbr
    ,     child_part
    ,     SUM(qty_per)
    FROM     BOM
    GROUP BY     part_nbr
    ,          child_part
    ORDER BY     part_nbr
    ,          child_part
    ;will not give the desired results, as it doesn't take into account the quantity required of each child's parent, but I can't figure out how to do that.
    The sample data I have provided represents data from a table or materialized view that is, roughly, the result of a hierarchical query of data in another table or three. If it's simpler to work off the tables on which this table is based, let me know, and I can put together some sample data from those tables.

    Hi,
    user11033437 wrote:
    Hi all...
    I am trying to determine the total quantity of each unique part number in a bill of materials (big list of parts that go into a final product). The total needs to take into account the quantity of the parent parts--what I mean by this is, if you have final product 'A' that takes 1 x part 'B' and 2 x part 'C', and part 'C' takes 1 x part 'B' and 3 x part 'D' then the totals of all unique parts in product 'A' would be: 3 x B, 2 x C, 6 x D.That's a very good explanation in general terms. No doubt, for you, applying that to the specific data is trivial, but most of us aren't as familiar with your application as you are. It would help a lot if you posted a similar explanation using specific ids from the sample data. For example, why do the desired results include:
    PART_NBR    CHILD_PART  TOTAL_QTY  
    ABC-123     HARDWARE-1  46     If someone explores the data enough, they might guess that the number 46 is the sum of 26 and 20=2*10, but it would sure save a lot of time if you, to whom this is second nature, could explain it.
    It would be nice if this query ran under 8i, but if it's much more complex than the equivalent query for 10g, don't worry about making it work for 8i. Sorry, I don't know any simple way to do this in Oracle 8.1. The SYS_CONNECT_BY_PATH function, introduced in Oracle 9, is essential to the solution below.
    Here is some sample data:
    CREATE TABLE     BOM
    INSERT INTO BOM VALUES ('ABC-123','   50020001121',1,'ABC-123',500,'HARDWARE-3',5);
    Good job.
    It looks like only about half of the columns have anything to do with this problem. Here's another place where sharing your knowlege ot he application could really help people. Don't post things that are irrelvant to the problem you're asking. If there's a sincere doubt, then say somthing like "I need part_nbr, bill_seq and bill_level in the output for my real problem. I don't think they have anything to do with getting the total qty, but I'm posting them just in case."
    Here are the results I expect (I don't care about the order, this is just the order I hand-calculated the results in):
    PART_NBR    CHILD_PART  TOTAL_QTY  
    ABC-123     ABC-123-1   1          
    ABC-123     HARDWARE-1  46    
    12345-1     RAW-3       27          Clearly this query:
    SELECT     part_nbr
    ,     child_part
    ,     SUM(qty_per)
    FROM     BOM
    GROUP BY     part_nbr
    ,          child_part
    ORDER BY     part_nbr
    ,          child_part
    ;will not give the desired results, as it doesn't take into account the quantity required of each child's parent, but I can't figure out how to do that.Thanks for posting the query. Even though it doesn;t work, it helped me understand what you wanted, and saved me some time.
    The sample data I have provided represents data from a table or materialized view that is, roughly, the result of a hierarchical query of data in another table or three. If it's simpler to work off the tables on which this table is based, let me know, and I can put together some sample data from those tables.I don't know if it would be any simpler. It might be more efficient, but I don't know how much that matters to you. Try the solution below. If it takes, say, 60 seconds, is it worthwhile trying to see if we can get it to run in 15?
    This seems to get the right results:
    SELECT     part_nbr
    ,     child_part
    ,     SUM (eval_number ('1' || SYS_CONNECT_BY_PATH (qty_per, '*')))     AS total_qty
    FROM     bom
    START WITH     parent_part     = part_nbr
    CONNECT BY     parent_part     = PRIOR child_part
    GROUP BY  part_nbr
    ,       child_part
    ORDER BY  part_nbr
    ,       child_part
    ;Do some experiments, on variations of this query, if you don't understand what SYS_CONNECT_BY_PATH is doing. You'll see that it's returning a string, such as '*2*1*1*6.75' that reflects the quantities needed at each level of the process. To actually do the multiplication, and get a number, I used this function:
    CREATE OR REPLACE FUNCTION     eval_number
    (     in_txt     IN     VARCHAR2
    ,     err_val     IN     NUMBER     DEFAULT     NULL
    RETURN     NUMBER
    IS
    --          **   e v a l _ n u m b e r   **
    --          eval_number attempts to evaluate in_txt as a NUMBER,
    --          returning that value.  If in_txt can not be interpreted,
    --          then err_val is returned.
         result_txt     VARCHAR2 (100);
         return_val     NUMBER;
    BEGIN
         EXECUTE IMMEDIATE     'SELECT '
                   ||     in_txt
                   ||     ' FROM dual'
                   INTO     return_val;
    --     dbms_output.put_line (result_val || ' = result_txt in eval_number');
         RETURN     return_val;
    EXCEPTION
         WHEN OTHERS
         THEN
    --          dbms_output.put_line (SQLERRM || ' = error in eval_number');
              RETURN     err_val;
    END     eval_number
    SHOW ERRORSI hate using "WHEN OTHERS" like this. Perhaps someone can suggest a reasonable set of specific errors that could be caught in the EXCEPTION section.

  • Percentage calculation at Grand Total Level

    Hello,
    I have issue in calculating the percentage at grand total level. I have three measures (A count, B count and Total count). These measures are defined in rpd with aggregation rule as sum. In answers i am calculating A % as 100*A count/Total Count. I have defined the aggregation rule for this percentage column as default. I am able to get correct % results for sub total level but getting wrong percentage values when Grand Total level is added. Going through some posts in this forum, people have suggested to enable this tag in instance config file.
    <ReportAggregateEnabled>true</ReportAggregateEnabled>
    After adding this tag, i am able to get correct results. The issue is when there is no data i am able to see table view with all columns having blank values even though i have defined the no result view.
    Please Help

    HI,
    For your CKF set exception aggregation as summation based on the last most characteristic in the row in the reference(as per the example it is product)
    Regds,
    Shashank

  • Query for calculation in ALV Total

    HI All,
    I am using Sub_tot = "X" & do_sum="X" to get the subtotals & Totals for different columns Using REUSE_ALV_LIST_DISPLAY.
    I am calculating percentage in column "C" depending on result of Column "A" & Column "B", which is also achieved.
    My requirement is, Percentage in Total column to be calculated with use of TOTAL OF COLUMN "A" & TOTAL OF COLUMN "B". Because simply totaling all the values of percentage column will not work.
    Any Pointers will be helpful.
    Thanks In advance.
    Regards,
    Siddhesh Sanghvi.

    hi ,
       this is another example  for displaying the subtotals in many times ...
    report  zvg_alv_slist2                          .
    type-pools: slis.
    G L O B A L   I N T E R N  A L   T A B L E S
    data: gt_fieldcat type slis_t_fieldcat_alv,
          gs_layout   type slis_layout_alv,
          gt_events   type slis_t_event.
    data: it_sort type slis_t_sortinfo_alv ,
          wa_sort type slis_sortinfo_alv .
    data: gs_print type slis_print_alv.
    data: begin of it_sflight occurs 0,
            carrid     like sflight-carrid,
            connid     like sflight-connid,
            fldate     like sflight-fldate,
            price      like sflight-price,
            planetype  like sflight-planetype,
            seatsmax   like sflight-seatsmax,
            seatsocc   like sflight-seatsocc,
            paymentsum like sflight-paymentsum,
         end of it_sflight.
    *DATA: GI_SFLIGHT LIKE STANDARD TABLE OF ST_SFLIGHT.
    data: g_repid like sy-repid.
    data: gt_list_top_of_page type slis_t_listheader.
    data: v_total(5).
    start-of-selection.
      g_repid = sy-repid.
      perform init_fieldcat  using gt_fieldcat[].
      perform build_eventtab using gt_events[].
      perform build_comment  using gt_list_top_of_page[].
      perform get_data.
      perform set_layout using gs_layout.
    SORTING
      clear wa_sort.
      wa_sort-fieldname = 'CARRID'.
      wa_sort-up = 'X'.
      wa_sort-group = '*'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-fieldname = 'CONNID'.
      wa_sort-up = 'X'.
      wa_sort-group = 'UL'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
    DISPLAY LIST
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_interface_check       = ' '
          i_callback_program      = g_repid
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat[]
          it_sort                 = it_sort[]
          it_events               = gt_events
          is_print                = gs_print
        tables
          t_outtab                = it_sflight
        exceptions
          program_error           = 1
          others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    *&      Form  INIT_FIELDCAT
    form init_fieldcat using    p_gt_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv,
            l_index type sy-tabix.
      data :rep like sy-repid.
      rep = sy-repid.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
        exporting
          i_program_name         = rep
          i_internal_tabname     = 'IT_SFLIGHT'
          i_inclname             = rep
        changing
          ct_fieldcat            = gt_fieldcat
        exceptions
          inconsistent_interface = 1
          program_error          = 2
          others                 = 3.
      if sy-subrc <> 0.
        message id sy-msgid type 'S' number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-subrc.
      endif.
      sort gt_fieldcat by col_pos.
      loop at gt_fieldcat into ls_fieldcat.
        l_index = sy-tabix.
        if ls_fieldcat-fieldname = 'PRICE'.
          ls_fieldcat-do_sum = 'X'.
          ls_fieldcat-sp_group = 'X'.
          modify gt_fieldcat from ls_fieldcat index l_index .
        endif.
      endloop.
    endform.                    " INIT_FIELDCAT
    *&      Form  BUILD_EVENTTAB
    form build_eventtab using  p_gt_events type slis_t_event.
      data: ls_event type slis_alv_event.
      clear ls_event.
      ls_event-name = slis_ev_top_of_page.
      ls_event-form = 'XTOP_OF_PAGE'.
      append ls_event to p_gt_events.
      clear ls_event.
      ls_event-name = slis_ev_top_of_list.
      ls_event-form = 'XTOP_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
      clear ls_event.
      ls_event-name = slis_ev_end_of_page.
      ls_event-form = 'XEND_OF_PAGE'.
      append ls_event to p_gt_events.
      ls_event-name = slis_ev_end_of_list.
      ls_event-form = 'XEND_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
    endform.                    " BUILD_EVENTTAB
    *&      Form  BUILD_COMMENT
    form build_comment using   p_gt_list_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
      ls_line-typ = 'H'." = Header, S = Selection, A = Action
      ls_line-key = 'KEY'.
      ls_line-info = 'INFO'.
      append ls_line to p_gt_list_top_of_page.
    endform.                    " BUILD_COMMENT
    *&      Form  SELECTION
    form get_data..
    data: l_rows type i value 3.
    Read data from table SFLIGHT
      select carrid
             connid
             fldate
             price
             planetype
             seatsmax
             seatsocc
             paymentsum
         from sflight
         into table it_sflight.
        up to l_rows rows.
      sort it_sflight.
    endform.                    " SELECTION
    *&      Form  SET_LAYOUT
    form set_layout using  p_gs_layout type slis_layout_alv.
    *  P_GS_LAYOUT-F2CODE            = P_F2CODE.
      p_gs_layout-zebra          = 'X'.
      p_gs_layout-colwidth_optimize = 'X'.
      p_gs_layout-no_input          = 'X'.
      p_gs_layout-no_colhead        = space.
      p_gs_layout-totals_text       = 'Total Price'.
      p_gs_layout-subtotals_text    = 'Sub Total'.
      p_gs_layout-totals_only       = 'X'.
      p_gs_layout-key_hotspot       = 'X'.
      p_gs_layout-detail_popup      = 'X'.
      p_gs_layout-no_subtotals      = space.
      p_gs_layout-expand_all        = 'X'.
      p_gs_layout-group_buttons     = 'X'."space.
    endform.                    " SET_LAYOUT
          FORM XTOP_OF_PAGE                                             *
    form xtop_of_page.
    data : lv_page(5),
            lv_text(20).
      MOVE SY-PAGNO TO LV_PAGE.
      write:/  'X_TOP_OF_PAGE'.
    endform.                    "xtop_of_page
          FORM XTOP_OF_LIST                                             *
    form xtop_of_list.
      write:/  'X_TOP_OF_LIST'.
    endform.                    "xtop_of_list
          FORM XEND_OF_PAGE                                             *
    form xend_of_page.
      write:/  'X_END_OF_PAGE'.
    endform.                    "xend_of_page
          FORM XEND_OF_LIST                                             *
    form xend_of_list.
      write:/  'X_END_OF_LIST'.
      data : lv_page(5),
             lv_text(20).
      data : l_lines type i,
             l_line  type i.
      clear v_total.
      write sy-pagno to v_total left-justified.
    export v_total to memory id 'V_TOTAL'.
      do sy-pagno times.
        lv_page = sy-index.
        concatenate 'Page' lv_page 'of' v_total
             into lv_text separated by space.
        if sy-index = 1.
          read line 2 of page sy-index.
        else.
          read line 1 of page sy-index.
       endif.
        sy-lisel+60(20) = lv_text.
          modify current line .
      enddo.
    endform.                    "xend_of_list
          USER_COMMAND                                             *
    form user_command  using r_ucomm like sy-ucomm
                              rs_selfield type slis_selfield.
      case r_ucomm.
        when 'EXIT'.
          leave to screen 0.
        when '&IC1'.
          data: text(256),text1(6),text2(5).
          move rs_selfield-tabindex to text1.
          move rs_selfield-sumindex to text2.
          concatenate  'Double clicked on (field:'
                        rs_selfield-fieldname
                        'Value:'
                        rs_selfield-value
                        text1
                        text2
                        into text
                        separated by space.
          call function 'POPUP_TO_DISPLAY_TEXT'
            exporting
              textline1 = text.
      endcase.
    endform.                    "user_command
    regards,
    venkat.

  • Percent or Total cost in ssrs

    Hi
    Im trying to display the cost parts share in percent of the total cost. in normal cases i would use the Scope argument to divide the cost parts against total cost but this time i have no sumaraized level for total cost to use as Scope
    parameter. Is it possible to open a new column where i divide the sum of landinvestment 1 768 with Total Project cost 16237 in some way and how the code for doing that?
    Br Arne  
    Arne Olsson

    Hi Arne,
    According to your description, you want to calculate the cost percentage of total cost without having a total row in your tablix. Right?
    In Reporting Service, we can specify scope (dataset/group) when using aggregation functions. In this Scenario, if we don’t have any scope to group that three items, it’s impossible to get the total cost of them. At least we should have a parent group/dataset
    for that three items, so we can use the group/dataset name as scope in aggregation function.  We tested this case in our local environment. Here are screenshots:
    Reference:
    Aggregate Function (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou
      

  • How to do the  Calculation of Employeeu0092s Total Compensation

    Hi Im stuck coding with this codes hope you could help me. Please advice me a possible way to code this one. Thanx!!!
    Step 4: Calculation of Employee’s Total Compensation
    As mentioned in Step 3, wage types are scattered in different infotypes which needs to be summed up to come up with the final employee’s “Total Compensation”.  In order to accumulate the total compensation of an employee that will be referenced by the  Bill Code & Activity Type Assignments Table (Name: ZHBILLACTVTY), the following infotypes should be read:
    -     Infotype 0008 (Basic Pay)
    -     Infotype 0015 (Additional Payments)
    -     Infotype 0014 (Recurring Payments and Deductions)
    Infotype 0008 – Basic Pay
    Retrieve “Annual salary” on table PA0008, field ANSAL. This amount should be added to the “Total Compensation” counter.  You can do this using the function module HR_READ_INFOTYPE or you can do a SELECT from table PA0008.
    Infotype 0015 – Additional Payments
    The wage type amount from infotype 0015 must be read in order to add any additional payments to the “Total Compensation” counter. The custom Compensation Components table (Name: ZHCOMPENSTN) defined in this extension indicates which wage types will be applicable for each country. Therefore, the following logic should be followed:
    a)     Loop through all of the employee’s records for Infotype 0015.
    b)     If the wage type (PA0015-LGART) is assigned to the employee's country (Based on the custom Compensation Component table ZHCOMPENSTN), then proceed to next step. Otherwise, skip the record since this will not be included or added in the “Total Compensation” counter.
    c)     If the payment date (PA0015-BEGDA) is between the start date of the fiscal year (Sept 01) and the end date of the fiscal year (Aug 31), then add the additional payment amount (PA0015-BETRG) to the Total Compensation counter.
    d)     Endloop. (Repeat process for the next record for Infotype 0015)     
    Infotype 0014 – Recur. Payments/Deds.
    The last among the scope of the calculation for an employee’s Total Compensation will be recurring payments. The wage type amount from Infotype 0014 must be read in order to add any recurring payments to the Total Compensation counter. The custom “Compensation Components” table (ZHCOMPENSTN) indicates which wage types will be applicable for each country thus will be added to the Total Compensation package.
    The following logic below will detail how to capture all payments for the fiscal year. Again, in order to get all the Infotype 0014 records of an employee you can use the function module “HR_READ_INFOTYPE” or execute a SELECT statement from table PA0014.
    Basic logic flow will be as follows:
    LOOP through all of the employee’s records for Infotype 0014.
    IF wage type (PA0014-LGART) is assigned to the employee’s country (check on table ZHCOMPENSTN).
         Proceed to detailed logic for Scenarios 1 – 4 below.
    ELSE
                Exit. (Skip the wage type since it is not applicable to the country’s calculation)
    ENDLOOP
    Detailed Scenarios 1 – 4
    Scenario 1 – When the payment started before the beginning of the fiscal year AND is still being paid out.
    IF payment end date (PA0014-ENDDA) = ’12.31.9999’ (Delimited) AND 1st payment date (PA0014-ZDATE) < Sept. 01 of the current fiscal year
          Accumulate all payments occurring between Sept 01 and Aug 31 of the current fiscal year (Refer below for the logic determining and accumulating all payments for the fiscal year).
    Scenario 2 – When the payment started within the fiscal year AND is still being paid out.
    ELSEIF payment end date (PA0014-ENDDA) = ’12.31.9999’ (Delimited) AND 1st payment date (PA0014-ZDATE) > Aug 31 of the current fiscal year
          Accumulate all payments occurring between the 1st payment date and Aug 31 of the current fiscal year (Refer below for the logic determining and accumulating all payments for the fiscal year).
    Scenario 3 – When the payment started within the fiscal year BUT also ended within the fiscal year.
    ELSEIF payment end date (PA0014-ENDDA) <> ’12.31.9999’ (Delimited) AND 1st payment
    date > Aug 31 of the fiscal year.
          Accumulate all payments occurring between the 1st payment date and the end date of the record (PA0014-ENDDA). (Refer below for the logic determining and accumulating all payments for the fiscal year).
    Scenario 4 – When the payment started before the beginning of the fiscal year BUT also ended within/during the fiscal year.
    ELSEIF (payment end date (PA0014-ENDDA) <> ’12.31.9999’ (Delimited) AND payment end date within current fiscal year) AND 1st payment date < Sept 01 of the fiscal year
            Accumulate all payments occurring between the Sept 01 of the current fiscal year and the end date of the record (PA0014-ENDDA). (Refer below for the logic determining and accumulating all payments for the fiscal year).
    ELSE
          Exit (Skip the wage type since the full payment has accrued in previous fiscal years)
    ENDIF  
    Logic for determining and accumulating all payments for the fiscal year
    A variable (ex: [Payment date]) should be used to store each successive payment. The variable should be initialized as follows, depending on the scenario. 
    For Scenario 1, set [Payment date] = 1st payment date occuring after Aug 31 (current fiscal year)
    For Scenario 2, set [Payment date] = 1st payment date (Screen field: P0014-ZDATE)
    For Scenario 3, set [Payment date] = 1st payment date (Screen field: P0014-ZDATE)
    For Scenario 4, set [Payment date] = 1st payment date occuring after Aug 31 (current fiscal year)
    IF  the [Payment date] is <= to the infotype 0014 record end date (PA0014-ENDDA), do
    If the [Payment date] is in between the start and end date of the current Fiscal year
         If the unit (PA0014-ZEINH) is “Days”,
               [Payment date] = [Payment date] + (# of days)
               Add recurring payment (PA0014-BETRG) to total compensation counter
               Endif
         If the unit (PA0014-ZEINH) is “Weeks”, then {
                  [Payment date] = [Payment date] + (# of weeks)
               Add recurring payment (PA0014-BETRG) to total compensationcounter
         Endif
         If the unit (PA0014-ZEINH) is “Months”, then {
                  [Payment date] = [Payment date] + (# of months)
                Add recurring payment (PA0014-BETRG) to total compensation counter
         Endif
         If the unit (PA0014-ZEINH) is “Years”, then {
                   [Payment date] = [Payment date] + (# of years)
                Add recurring payment (PA0014-BETRG) to total compensation counter
         Endif  
    Endif
    Endif
    Repeat for next payment
    Repeat for the next infotype 0014 record (if it exists)
    Once the above processing is complete, the “Total Compensation” counter should contain the employee's total compensation that should be used when referencing the Bill Code & Activity Type Assignment table ZHBILLACTVTY.

    Hello,
    do you know where can I configure "Total Compensation Statement"? I'm working in ERP 2004.
    I've created a new form in Smart Forms and now I want to change the default form used in the Portal.
    Thanks a lot
    Antonio

  • Calculated Key Figure Total

    I have a query on our Production system which works fine and which I need to recreate on our test system.
    The query has two key figures the first a normal KF containing the number of documents (Doc Count). The 2nd is a Calculated KF of
    Days Open  / Doc Count
    Where Days open is also a CKF.
    At the detail level the report is fine but the Result is a Problem, in the example it is  -586,752 not 36 ( 182/5).
    Maint Area                    Transaction Number     Doc.Count      Avg Days Open
    Carholme Ward D, E,     0000065543                1                           70
                         0000065553                1                              70
                         0000065898                          1                         23
                         0000065908                          1                           4
                         0000065925                1                            15
         Result                                                5                   -586,752
    I have the same issue when I remove the transaction number from the report.
    Maint Area                          Doc. Count     Avg Days Open
    Carholme Ward D, E,                 5                      -586,752
    The queries look the same on Production and on the Test system and I have checked  the Properties of the Key Figures. I have also gone through the various Options under the Calculate, Result As ( e.g, Summation, Counting All Values etc.)
    I have run out of ideas and any help would be appreciated.
    Thanks
    Jenny

    The solution was the Aggregation level on the CKF which were being used to produce the CKF 'Days Open'

  • Percent of Total Report

    We have a requirement to create a report with Grand Total and % of Total.
         Cat1     Cat2     Row Total     PCT of Total
    Type1     30     10     40     26.67%
    Type2     20     50     70     46.67%
    Type 3     10     30     40     26.67%
    Column Total     60     90     150     100.00%
    PCT of Total     40%     60%     100%     
    Here Row Total and Column Total can be achieved as Row aggregation and Column aggregation in a pivot table.
    PCT of Total at Row level needs to be Row Total/Overall Total.
    Eg 40/150 =26.67%
    Is there a way to achieve this in OBIEE?
    Thanks
    Ann.

    group 1: 19.5
    group 2: 148.4
    actual Grand Total: 347.48
    Then there are at least 3 groups. You don't say. So, how many
    groups are there altogether?

Maybe you are looking for

  • Problem with safari download manager

    I'm having the following problem how do I download do not stop when I close Safari, is there any way, eg when I'm downloading xcode and closing the browser it is stopped and can not resume from where it was, I ask how it assists , would act as a down

  • Error:numeric or value error : buffer too small

    hi can any one please help me? i am developing the application in HTMLDB. i have an error numeric or value error: char buffer too small. i have an attributes plan_name,type......att_header1 in the database. The data's were inserted to the database, w

  • Can i install gtx titan on mac pro*

    can i install gtx titan on mac pro* help please Thanks

  • Service For Objects Function/Button in BP - missing when performing BDC?

    Hi all,     I'm currently working on a conversion program that creates Business Partners in the transaction BP by using CALL TRANSACTION. The first thing I did was to record the transaction in SHDB. My problem is, the Services for Object button is mi

  • Is there a Adobe Captivate Exchange or Add-on Section

    Is there a Adobe Captivate Exchange or Add-on Section that I am overlooking? If there isn't an official Adobe section are there any suggested places? Or are elearningtemplates.com and elearningart.com the only official places now? Thank you