Percent on Running totals

Post Author: llcoolt
CA Forum: Formula
I have a couple of group running totals:
TotalItems
TotalCompleteAtExp
I need to create a formula that finds the percentage of the two.  Any help?  Would this be in a running total?

Post Author: llcoolt
CA Forum: Formula
but it's calculated at a group level, not as a percentage for the whole report. 
The running totals were grouped by vendors.  The percentage I was looking for was also grouped by vendor, not a percentage of ALL service orders and the vendors they were assigned to, but percentages run per vendor based on those completed by vendor.

Similar Messages

  • Percent of running total is returning running percents

    I have a running total in a Group footer.  I want to print the detail percentage of the group total, but the percent doesn't calculate on the total, but rather on the running balance.  For example:
    LINE 1   $25     100%
    LINE 2   $25       50%
                 $50
    But what I need is:
    LINE 1   $25     50%
    LINE 2   $25       50%
                 $50

    Solved my problem.  Used a group total instead of running total.

  • Charting Running Totals as Percentage

    I'm trying to show a running total as a percent of another running total in a chart.
    The report details have a unit ID (serial Number) and a flag indicating whether or not the unit went through rework.
    Running total 1 is a distinct count of unit ID, running total 2 is a distinct count of unit ID where the flag is No.
    I can make a chart that shows both counts, but running total 2 is always a count, and I'd like to show it as a percent of running total 1.
    I can create a formula that shows total2 as a percent of total 1 and put this in the group footer - but I can't chart on that formula.
    Is what I'm trying to do possible?
    Thanks
    Edited by: Doug McLauchlan on Mar 26, 2010 7:22 PM - Spelling

    I finally found an answer here:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f055d37d-2ddc-2c10-6ea3-d454e6f3bf94
    The technique involves building your charted values into strings and passing them to a sub-report to do the charting.
    I found I had to make several changes to way the report works in my situation - mainly because of grouping.

  • Item Transaction History Report - Calculation for creating 'Running Total'

    Hello
    Using Oracle Discoverer, we have written a report that pulls back all Inventory Transactions (by item number). This report lists both transactions IN (e.g. receipts into the store) and OUT (e.g. issues out from the store).
    Our customer would like an additional column, to represent 'Running Total', to be added to the report. This column needs to capture the running 'On Hand Quantity' for the associated Item, as each transaction (both transactions IN and OUT of store) is displayed.
    For example, if the initial/first transaction for an item was a Receipt of 500, then this column (on the first line) should display 500. If the second transaction for the item was an issue of 15, then this column (on the second line) should display 485. If the third transaction was for an issue of 50, then this column (on the third line) should display 435. If the fourth transaction was for a receipt of 20, then this column (on the fourth line) should display 455 etc etc
    I'm not sure how I'd write a calculation to cater for this (within discoverer) - do you know if this is achievable? Any help would be much appreciated. This would be easy enough to do in Excel, but I'm a bit of a novice when it comes to discoverer(!)
    Many thanks
    Ross

    Hi,
    You can generally do this type of calculation using analytic functions. You would partition by the item number and order by the transaction date in the analytic function. You can use SUM function (with an order by) to get a running total of a column in the report. You can SUM a calculation containing a CASE statement which changes the OUT transactions to a negative number. The SUM function will start at zero, so you then can use FIRST_VALUE function to get the first value for the item which you could then add to the totals.
    Rod West

  • Showing  running totals on AR statatement Report

    Hi All I need assistance in populating the Running totals on AR statement Report  , I am trying to calculate the running total on the RDF using the (sum Over Partition ) and Not on the RTF template please assist .
    here is my query below :
    select customers.customer_name,
      detail.customer_id,
      detail.customer_site_use_id,
    :CP_ACC_NAME,
    :CP_ACC_NUM,
    :CP_BRNCH_NAME,
    :CP_COL_EMAIL,
    :CP_COL_PHONE,
    :CP_BRANCH_NR,
    decode(  (select meaning
    from ar_lookups
    where lookup_type = 'INV/CM/ADJ' and lookup_code =  detail.class), 'Payment', apply_date, trx.trx_date)  TRX_DATE,
    trx.INVOICE_CURRENCY_CODE,
    trx.INVOICE_CURRENCY_CODE INVOICE_CURRENCY_CODE_BAL,
    NVL(trx.term_due_date,trx.TRX_DATE)  term_due_date,
    detail.customer_id cst_id,
      detail.customer_site_use_id cst_site_id,
      detail.customer_trx_id,
      detail.trx_number,
       (select meaning
    from ar_lookups
    where lookup_type = 'INV/CM/ADJ' and lookup_code =  detail.class) class,
      detail.amount_full_original,
      detail.end_bal * -1 , (detail.end_bal + detail.amount_full_original)* -1  closing_balance ,
    detail.amount_full_original -  detail.the_order * -1  closing_bal,
      (detail.amount_full_original - detail.running_total) running_total ,
      detail.running_tot ,
      customers.customer_name address1,
      customers.address1 address2,
      customers.address2 address3,
      customers.address3 address4,
      customers.city||' '||customers.state address5,
      customers.country||' '||customers.postal_code address6,
      addr.address1 rm_address1,
      addr.address2 rm_address2,
      addr.address3 rm_address3,
      addr.address4 rm_address4,
      addr.address5 rm_address4,
       :p_as_of_date_from date_from,
       to_char(to_date(:p_as_of_date_to,'DD-MON-YYYY'),'DD-Mon-YYYY') date_to,
      addr.org_id rm_org_id,
       rtrim(to_char(sysdate,'DD')||' '||to_char(sysdate,'Month'))||' '||to_char(sysdate, 'YYYY') curr_date
    from (select customer_id, CUSTOMER_SITE_USE_ID, trx.CUSTOMER_TRX_ID,trx.TRX_NUMBER, null apply_date,ps.class,ps.AMOUNT_DUE_ORIGINAL amount_full_original, the_trx.end_bal,the_trx.running_total , the_trx.running_tot , 1 the_order
    select customer_trx_id, sum(acctd_end_bal) end_bal  , running_total  ,  running_tot
    SELECT ps.customer_trx_id ,
       sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_from))
      * ps.amount_due_remaining) start_bal,
       sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_to))
      * ps.amount_due_remaining) end_bal,
       sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_from))
      * ps.acctd_amount_due_remaining) acctd_start_bal,
       sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_to))
      * ps.acctd_amount_due_remaining) acctd_end_bal ,
       (sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_from))
      * ps.amount_due_remaining) + sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_to))
      * ps.acctd_amount_due_remaining) ) running_total ,  
       sum((sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_from))
      * ps.amount_due_remaining) + sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
       NULL,to_date(:p_as_of_date_to))
      * ps.acctd_amount_due_remaining) )) over (partition by ps.customer_trx_id  order by ps.customer_trx_id)running_tot
       FROM ar_payment_schedules_all ps
       WHERE ps.payment_schedule_id+0 > 0
       --JF2 AND ps.gl_date_closed >= to_date(:p_as_of_date_from)
       AND  ps.class IN ( 'CB', 'CM','DEP','DM','GUAR','INV')
       AND  ps.gl_date  <= to_date(:p_as_of_date_to)
       and org_id = nvl(:P_ORG_ID,org_id)--1246
       --and customer_id = :p_customer_id --1075
       --and CUSTOMER_SITE_USE_ID = :p_customer_site_id --1066
       --and customer_trx_id = 66291
       --'|| l_ps_org_where ||'
       GROUP BY ps.customer_trx_id ,ps.acctd_amount_due_remaining , ps.gl_date,ps.gl_date_closed ,ps.class , rownum 
      ps.customer_trx_id ,
       sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
      ra.gl_date,to_date(:p_as_of_date_from))
      * ( ra.amount_applied  + NVL(ra.earned_discount_taken,0)
       + NVL(ra.unearned_discount_taken,0))) start_bal,
       sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
      ra.gl_date,to_date(:p_as_of_date_to))
      * ( ra.amount_applied  + NVL(ra.earned_discount_taken,0)
       + NVL(ra.unearned_discount_taken

    Hi
    Yes i would like more help as i have never used group by roll up before
    SELECT p.employee_number,
    p.full_name employee_name,
    DECODE (p.sex, 'M', 'Male', 'F', 'Female') gender,
    (DECODE (p.per_information4,
    '01', 'Indian',
    '02', 'African',
    '03', 'Coloured',
    '04', 'White')) race,
    p.original_date_of_hire,
    a.effective_start_date startdate_current_position,
    RTRIM (SUBSTR (ps.NAME, 1, INSTR (ps.NAME, ';')), ';') current_position,
    ho.NAME current_organization,
    xx_return_company_name(a.person_id, a.effective_start_date) current_company,
    RTRIM (SUBSTR (ps1.NAME, 1, INSTR (ps1.NAME, ';')),';') previous_position,
    ho1.NAME previous_organization,
    xx_return_company_name(a1.person_id, a1.effective_start_date) previous_company,
    a1.effective_start_date startdate_prev_position
    FROM per_assignments_v2 a,
    per_assignments_v2 a1,
    per_all_people_f p,
    per_all_positions ps,
    per_all_positions ps1,
    hr_all_organization_units_tl ho,
    hr_all_organization_units_tl ho1
    WHERE a1.person_id = a.person_id
    AND NVL (a1.position_id, 9) <> a.position_id
    AND a1.effective_end_date = a.effective_start_date - 1
    AND p.person_id = a.person_id
    and ho.ORGANIZATION_ID=ps.ORGANIZATION_ID
    and ho1.ORGANIZATION_ID=a1.ORGANIZATION_ID
    AND a.effective_start_date BETWEEN p.effective_start_date AND p.effective_end_date
    AND a.position_id = ps.position_id
    and p.EMPLOYEE_NUMBER not in ('1','2','3')
    AND a1.position_id = ps1.position_id(+)
    order by p.full_name

  • XML 5.6.1 Running Total

    Hi
    I am new this XML Publisher. We are working on using BPA/XML Publisher to print the AR Invoice. I have two questions
    1. How to print the values of subtotal, tax and Invoice Total in only last page
    2. How to print the Running total of extend amount at the end of the each page. This Running total need to be printted once in a Page.
    Thanks
    Mariappan

    Have you placed it outside your group, you just place it at the bottom end of your template and put a group around your sum total.
    Then it it will only be printed on your last page.
    you need a for tag
    ex. <?for-eachG_TAX?>
    Then the sum
    ex. <?sum(current-group()//VAT)?>
    Then the end tag
    ex. <?end for-each?>

  • Running total in report footer returning inaccurate result

    Post Author: smarkta
    CA Forum: Formula
    I am writing a report that contains 3 groups.  I have created running totals for each group that are accurate by selecting the group to evaluate and reset on.  now I need to basically sum the results of the all the group running totals but have had no success.  any tips on how to do this would be greatly appreciated.
    Thanks

    Post Author: Charliy
    CA Forum: Formula
    Were you doing a Distinct Count?  Did you have a formula on the Running Total?  What is there about the Group Totals that make them different than the final total.

  • How do I use a running total within a selection formula?

    I am developing a report within Crystal Reports 2008.  My goal is to identify any accounts that have zero usage for at least six months in this current year.  I have account number, meter size, read date, usage, and a running total/subtotal by account.
    Here is what the data looks like in the report
    ACCTNO     METER SIZE   READ DATE/TIME               READ_USAGE    Counter
    001022-05                    
    001022-05     2.00              9/28/2009  9:42:00 AM      0.00                     1
                                                                                    1
    001110-09               
    001110-09     2.00             3/2/2009  9:54:13 AM         0.00                      1
    001110-09     2.00             3/26/2009  1:32:28 PM        0.00                      1
    001110-09     2.00             4/27/2009  11:02:11 AM     0.00                      1
    001110-09     2.00             5/27/2009  1:13:53 PM        0.00                      1
    001110-09     2.00             6/19/2009  11:41:20 AM     0.00                      1
    001110-09     2.00     9/1/2009  8:13:25 AM         0.00                      1
                                                                                    6
    My report shows all accounts that have zero usage.  I want to filter the report to only show the accounts that have at least six zero usage reads.  I thought I could add a running total, sum it, and filter the data by using the selection formulas.  Unfortunately I keep getting an error message saying "this field cannot be used becuase it is being evaluated later."  Any help would be appreciated.  This is the first report I have created using crystal.
    Edited by: smwdrw2 on Oct 28, 2009 4:29 PM

    You could Conditionally suppress the account numbers where your running total is less than 6
    You will probably have to put your account number summaries in the group footer, instead of the header.
    Then:
    go to the section expert, click on the group footer for the account number, on the right, next to the word "Suppress" click on the box that says "X-2". In the formula put
    IF<6 then True
    Save and close
    The only way this would not work for you is if you have some sort of grand total that you don't want to include the other groups in.

  • How can I display the vendor associated with result of my running total sum

    I have a report that lists vendors with their most vecent order dates.  I need to set up a rotation so that the vendor with the latest order date is next to be selected.  I used the running total summary to pick the latest date.  How can I display the vendor associated with result of my running total summary?

    If your "latest" order date means the "oldest" order date, why don't you try this:
    Go to Report tab -> Record Sort Expert -> Choose your order date in ascending order
    This will make your oldest order your first record shown. 
    You can then create a running total count for each record.
    Lastly, in your section expert under conditional suppress X+2 formula, write this:
    {#CountRecords}>1
    The result will only show the oldest record in your report.
    I hope that helps,
    Zack H.

  • Running Total - How to summarize a formula field?

    I'm sorry if this comes over as stupid but I have got myself quite messed up and am not 100% au fait with Crystal Reporting.
    The aim of my report is to calculate the costs of selected tests and to calculate a grand total of all tests at the end.
    I have created a group of  jobtests.TestTypeName
    Details
    1. testTypeName - to show Test Name that is being calcutaed - Database field
    2. Count ({jobTests.testTypeName}, {jobTests.testTypeName}) - to show number of tests of that type - this is a formula field
    3. Analysis1 - to show the cost of that test type - Database field
    4. {@CountTests/TestType} * {jobTests.AnalysisN1} - to show the number of tests per test type mulitplied by the cost of that test type - this is a formula field
    Report footer
    Count ({jobTests.testTypeName}) - to count the total number of tests
    MY PROBLEM - I need to see the sum of 4, this would be my grand total
    Trying to run the Running Total I can't get it to Summarize the field 4 because it is a formula field.
    What can I do?
    Thanks.

    You can't do a SUM on a formula that uses another aggregate function.  However, for both 4 and your grand total, you just need to SUM() (with ",{jobTests.testTypeName}" for the #4 calc), as the database field will be the cost for each test in each record.
    HTH,
    Carl

  • Error when using running total variable in formula

    This is probably an easy syntax problem, but I'm fairly new to Crystal reporting.  I created a running total variable (count) called InquiryTypeSubtotal that simply counts the number of records.  I have one grouping level, and in the group footer I'd like to print a line showing the total count for that group that looks like
    Total inquiries for Assistive Technology: 3
    To accomplish this I'm using a formula field with the following syntax:
    "Total inquiries for " + {CnAttrCat_1.CnAttrCat_1_Description} + ": " + ToText(@InquiryTypeSubtotal)
    When I try to check the formula, I get the error message "The ) is missing."  What am I doing wrong?
    Thanks,
    Alec

    I put in the curly brackets so my formula now reads
    "Total inquiries for " + {CnAttrCat_1.CnAttrCat_1_Description} + ": " + ToText({@InquiryTypeSubtotal})
    Now when I check the formula I get the error message "This field name is not known."
    Alec

  • Running totals: Custom Reset via Formula? (VS 2005)

    Post Author: PunchngMrGrumpy
    CA Forum: .NET
    Hi All,I have attached a screenshot to help make up for my inability to describe the situation I'm dealing with here.I
    have three groups within a report that currently use distinct Running
    Totals fields that Reset at the group levels that I assigned. I am
    attempting to create a single Running Totals field for all 3 groups
    that will reset depending on which Group is being calculated at the
    moment so that I don't have to have 3 separate Running Totals object
    for each and every group. I'm not sure how to do this or write this
    formula as I'm new to Crystal Reports and am used to SQL Reporting
    Services where this evaluation is automatically done for you (I was
    spoiled I guess).For example, if the Running Totals field
    control is in Group #1, I want it to reset at Group #1, and Group#2 to
    reset at Group #2, etc without having to create a field for each group.So
    basically I'm attempting to use a formula to create a Reset point (view
    screenshot for detail) that is determined by which group the data is
    being calculated in. Is this possible? I realize that it is possible by
    simply creating a new running total object for each group and telling
    it to reset on change of group specified, but this seems completely
    redundant and overly time consuming for larger reports where there are
    multiple groups and a lot of Running totals fields.I'm developing the report with Crystal Reports within Visual Studio 2005 if that helps any.I
    don't know if you'll be able to see it, but I have a screenshot link to
    explain what I'm trying to do. http://www.codeguru.com/forum/attachment.php?attachmentid=19302Thanks!

    Hi Abhilash,
    Thanks for the code, but the totals aren't right still yet.
    Also, I just noticed my running total is not functioning properly.  Count be the reason for my delima.
    Any suggestions on how to get the running total to function properly?
    What I just noticed is:
    Date               Patient          Count
    7/9/13             Patient A       7
    8/8/13             Patient B       8
    8/8/13             Patient B       8
    8/8/13             Patient C       8
    8/8/13             Patient D       8
    8/15/13           Patient E       9
    Would I be better off to do a formula vs a running total?

  • Oracle report running total Resseting balance

    Dear All,
    I am developing report on Oracle R12 fixed Assets, I have to calculate the running total for each asset.
    In brief
    Asset 1
    cost Deprciation Adjusted Cost
    50 - 2 48
    48 -5 45
    45 - 4 41
    I achieved that by using
    if :p_val is null then
    :result := nvl(:cost,0)-nvl(:depriciation,0);
    :P_val :='5';
    return :result;
    else
    :result := nvl(:result,0)-nvl(:depriciation,0) ;
    return :result;
    end if;
    working fine
    But problem is when the next asset start on same report
    Asset 2
    cost Deprciation Adjusted Cost
    100 5 36
    it substracts the last total (running total of previous asset with depriciation which was 41 in this example).
    Oracle Champs pl advice me how to solve this.
    I really dont got any idea how to solve this.
    thanks

    Dear,
    Thanks for your reply , in your reply what you said I tried this but in pl/sql I am not actually achieving the result. The balance is not resetting at next group if you give one accurate line it would be really helpfull.
    thanks

  • Running total of calculated field in pivot

    VERSION: ORACLE 11
    TABLE:
    create table chart_detail (
    DIS        NUMBER,
    BLD_MO VARCHAR2(7),
    BLD        NUMBER(10),
    RPLC      NUMBER(10));DATA:
    insert into chart_detail values (60,'2011-03',0,2);
    insert into chart_detail values (150,'2011-04',10572,0);
    insert into chart_detail values (120,'2011-04',26449,5);
    insert into chart_detail values (30,'2011-04',0,1);
    insert into chart_detail values (60,'2011-04',0,7);
    insert into chart_detail values (90,'2011-04',0,9);
    insert into chart_detail values (120,'2011-05',5714,0);
    insert into chart_detail values (90,'2011-05',24557,1);
    insert into chart_detail values (60,'2011-05',0,4);
    insert into chart_detail values (30,'2011-05',0,0);
    COMMIT;EXPECTED RESULTS:
         2011-04                    2011-05               
    DIS     RPLC     BLD     TBLD     IPTV     RPLC     BLD     TBLD     IPTV
    30     1     0     37021     0.03     0     0     30271     0.00
    60     7     0     37021     0.22     4     0     30271     0.13
    90     9     0     37021     0.46     1     24557     30271     0.17
    120     5     26449     37021     0.59     0     5714     5714     0.17
    150     0     10572     10572     0.59               0     
    180               0                    0     
    TOTAL     22     37021               5     30271          PROBLEM: I need to have a running total of IPTV like in the above example. I can get the IPTV for each DIS/bld_mo but I don't know how to get the running total of it. In the script below I just used an example where I tried summing the IPTV like was done for build. I know it can't be done that way because IPTV is a calculated field in the query but if I substitute "APR_IPTV" with the formula for IPTV I get an error that window functions aren't allowed here. I do not know a way around this. I commented out the bad piece of code.
    PROBLEM SCRIPT:
    WITH  pivot_results  AS
      SELECT    dis
      ,    NVL (apr11_rep,  0)  AS apr11_rep
      ,    NVL (apr11_bld,   0)  AS apr11_bld
      ,    NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS apr11_tbld
    ,      DECODE(NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(apr11_rep, 0)*1000/ NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS apr11_iptv               
    ,      NVL ( SUM (apr11_iptv)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS apr11_tiptv  
      ,    NVL (may11_rep,  0)  AS may11_rep
      ,    NVL (may11_bld,   0)  AS may11_bld
      ,    NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS may11_tbld
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_iptv
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_tiptv               
      FROM     chart_detail
      PIVOT     (  MAX (rplc)  AS rep
              ,  MAX (bld)  AS bld
              FOR  bld_mo   IN ( '2011-04'  AS apr11
                                             , '2011-05'  AS may11
    SELECT    CASE
            WHEN  GROUPING (dis) = 0
            THEN  TO_CHAR (dis)
            ELSE  'Total'
        END      AS dis
    ,    SUM (apr11_rep)  AS apr11_rep
    ,    SUM (apr11_bld)  AS apr11_bld
    ,    SUM (apr11_tbld) AS apr11_tbld
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (apr11_iptv)
        END      AS apr11_iptv
    ,    SUM (apr11_tiptv) AS apr11_tiptv
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (apr11_tpiptv)
        END      AS apr11_tiptv
    ,    SUM (may11_rep)  AS may11_rep
    ,    SUM (may11_bld)  AS may11_bld
    ,    SUM (may11_tbld) AS may11_tbld
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (may11_iptv)
        END      AS may11_iptv   
    FROM    pivot_results
    GROUP BY  ROLLUP (dis)
    ORDER BY  pivot_results.dis
    ;Thank you,

    Hi,
    So you know how to compute iptv for an individual row; the problem now is that you want to get a running total of iptv; is that it?
    The problem there is that computing iptv requires an analytic function, and analytic functions can't be nested. To get the results of nesting f (g (x)), where f and g are analytic funtions, you have to compute g in a sub-query, and then use the results as the argument to f in a super-query.
    Here's how to apply that to your situation:
    WITH  pivot_results  AS
         SELECT    dis
    -- April, 2011
           ,           NVL (apr11_rep,   0)  AS apr11_rep
           ,           NVL (apr11_bld,   0)  AS apr11_bld
           ,           NVL ( SUM (apr11_bld)
                                       OVER (ORDER BY dis DESC)
                          , 0
                          )               AS apr11_tbld
         ,      NVL ( 1000 * apr11_rep
                              / NULLIF ( SUM (apr11_bld) OVER (ORDER BY dis DESC)
                                          , 0
                   , 0
                   )               AS apr11_iptv
    -- May, 2011
           ,           NVL (may11_rep,   0)  AS may11_rep
           ,           NVL (may11_bld,   0)  AS may11_bld
           ,           NVL ( SUM (may11_bld)
                                       OVER (ORDER BY dis DESC)
                          , 0
                          )               AS may11_tbld
         ,      NVL ( 1000 * may11_rep
                              / NULLIF ( SUM (may11_bld) OVER (ORDER BY dis DESC)
                                          , 0
                   , 0
                   )               AS may11_iptv
           FROM     chart_detail
           PIVOT    (    MAX (rplc)  AS rep
                    ,    MAX (bld)   AS bld
                    FOR  bld_mo   IN ( '2011-04'  AS apr11
                                      , '2011-05'  AS may11
    SELECT    CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  TO_CHAR (dis)
                  ELSE  'Total'
               END      AS dis
    -- April 2011
    ,           SUM (apr11_rep)  AS apr11_rep
    ,           SUM (apr11_bld)  AS apr11_bld
    ,           SUM (apr11_tbld) AS apr11_tbld
    ,           CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  ROUND ( SUM (SUM (apr11_iptv))
                                          OVER (ORDER BY  dis)
                      , 2
               END      AS apr11_iptv
    -- May 2011
    ,           SUM (may11_rep)  AS may11_rep
    ,           SUM (may11_bld)  AS may11_bld
    ,           SUM (may11_tbld) AS may11_tbld
    ,           CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  ROUND ( SUM (SUM (may11_iptv))
                                          OVER (ORDER BY  dis)
                      , 2
               END      AS may11_iptv
    FROM      pivot_results
    GROUP BY  ROLLUP (dis)
    ORDER BY  pivot_results.dis
    ;Output:
          APR11  APR11   APR11  APR11 MAY11  MAY11   MAY11  MAY11
    DIS    _REP   _BLD   _TBLD  _IPTV  _REP   _BLD   _TBLD  _IPTV
    30        1      0   37021    .03     0      0   30271    .00
    60        7      0   37021    .22     4      0   30271    .13
    90        9      0   37021    .46     1  24557   30271    .17
    120       5  26449   37021    .59     0   5714    5714    .17
    150       0  10572   10572    .59     0      0       0    .17
    Total    22  37021  158656            5  30271   96527As you can see, this is not quite what you wanted on the row where dis='150'. You asked for NULLS in the may11_rep, may11_bld and may11_iptv columns. You can get those results if you need them; just explain the rules that govern whether to display the values and when to display NULL.
    The way you posted the sample data and results, and the quantity of sample data were all excellent; it really helped me find a solution. Thanks.
    It would have also helped it you had explained how iptv is computed. Basically, iptv = 1000 * rep / tbld, right?
    It looks like most of this code:
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_iptvwas a way of avoiding divide by 0 errors; it would have been helpful if you had explained that.

  • Running total across 2 grouping

    Hi All
    I have created a crystal report and i have 2 remaining issues that i just cant get around.
    the report is basically about all the net stock position.
    the report is based on a query..that links sales order to all target documents that originate from the sales orders, i.e...deliveries, invoices, returns, credit notes.
    then i also brought in all the open purchase orders and the instock from the oitw
    i then sumed up the lines so the sales order > Delivery > invoice > credit note > returns all shows in one line..and if there is a different unit of measure it will be another line for that sales order
    the report is grouped:
                                  per warehouse
                                  per item
                                  per Sales Order Num
                                  per Item Unit of Measure
                                  per Line Num
    1st issue:
    in the selection criteria if the sales order is closed but if one of the delivery notes is open it should bring in the "whole set" not just the the open deliverys linked to the sales order.
    this is because the delivered quantities adds up to the net position of the stock.
    2nd issue:
    I have to work out a net postion
    formula: net stock = Oitw.instock + PO - remaining qty on sales order
    I got the sales order as a negative
    i used a running total formula, but it does not work if the sales order has more then one unit of measure.
    whileprintingrecords;
    If onfirstrecord or previous({Command.SO No.})<>{Command.SO No.} then
    numbervar remain_bal:= remain_bal + {@QTY}
    i tried to add another if statement..but does not work
    whileprintingrecords;
    If onfirstrecord or previous({Command.SO No.})<>{Command.SO No.} then
    If onfirstrecord or previous({Command.SO Uom)<>{Command.SO Uom.}  then
    numbervar remain_bal:= remain_bal + {@QTY}
    any help will be gladly welcomed..
    thank you all
    Jerusha

    Hi Dave
    Thank you very much for your feedback.
    I have been using the base UoM, ie InvQty field.
    my issues comes where i am grouping I am 1st grouping by sales order num, then by uom as the customer wants to see that as separate entries
    Example:
    SO Num     Uom     Qty     InvQty
    1               Bags     50         200
    1               Bulk     100        100
    This is the forumula for the running total:
    If onfirstrecord or previous ({Command.SO No.}) <> ({Command.SO No.}) then
    if ({Command.Doc Type}) = 'SO' then
        SO := SO + {@QTY}
    However when i "print" my total and add it to the footer.. it will show 200 instead of 300.
    Thanks
    Jerusha

Maybe you are looking for

  • Adobe flash player for 64 bit system

    I am having difficulities with down loading Adobe Flash Player. Adobe recognises my system as 64 bit but keeps downloading a 32 bit application that will not function on my computyer.

  • 1920x1080 TV as monitor not filling screen/black padding.

    I have an LE40C535 Samsung HDTV. I'm connected to it via VGA cable. When I choose 1920x1080 @ 60 hertz, the screen is compressed from the left and right with 2 black vertical rectangles. Setting to lower resolutions fills the screen but it looks poor

  • Issue on complete stock removal

    Dear All, I am configuring WM in my test system. Can anyone tell me what are the settings reqd for complete stock removal from a storage type so that the extra qty is returned to the source/destination storage bins when I create a TO against a delive

  • WLS 10.3.2 error - specific file not found system-jazn-data.xml

    I don't want to use this on my stand alone server. Does anyone know how to get around it asking for the file upon deployment? Is there a setting in the WLS console to disable this feature?

  • View score sets in list?

    been using logic forever and score on and off, but can't remember the answer to this: Is it possible to view score sets in a list (as you can with staff styles), for example in order to delete unwanted ones?