Summing up QTY on Hand

I am developing a report where I have qty on hand.  I am putting it into a report that reports sales and need to show qty on hand for all locations.  Example.  I have stores numbered 1,2,3,4,5 but only stores 1 and 2 have sales and the report shows that they sold 3 each for a total of six size 9 shoes sold.  However, the qty on hand field needs to show the qty on hand in all stores.  So, if each store has 5 size 9 shoes left, this field should 25 size 9 shoes left. 
I am sure I need to write a formula to pull all stores inventory into some sort of variable, then total it and put it on the report, but I can't get my brain around it.  Any help would be appreciated.

Hi Edison,
I'm going to make some huge assumptions here because I don't know how your report is laid out. 
Assuming your report is grouped like:
Group1 - Location
Group2 - SalesDate
Your report is laid out like:
                    QTY On Hand          Sold
  Location 1
    June 1              2                  0
    June 2              1                  1
    June 3              0                  1
  Total                 0                  2
                    QTY On Hand          Sold
  Location 2
    June 1              5                  0
    June 2              5                  0
    June 3              5                  0
  Total                 5                  0
                    QTY On Hand          Sold
  Grand Total           5                  2
To get the total for QTY on Hand try this formula:
Assuming you have the totals in GroupFooter1, drop the {table.QTYONHAND} field onto the GroupFooter1 section.  This will show the quantity on hand from the last record. 
To get the grand total for the QTY on hand, create a formula like, 
WhilePrintingRecords;
NumberVar QTYonHand;
QTYonHand := QTYonHand + {table.QTYONHAND};
Drop this formula onto the GroupFooter1 section also.  This formula has a variable called QTYonHand and will accumulate each time the formula is called in GroupFooter1. 
Now create one last formula like:
WhilePrintingRecords;
NumberVar QTYonHand;
Drop this into the Report Footer where the Grand Total should be.  This will be be the total for the QTYonHand. 
Good luck,
Brian

Similar Messages

  • Sum of qty of four tables comapring with other table

    I had four tables voy,bl,subbl,dcd, i have to find sum of qty form SUBBL and qty from DCD for all subbl group by CCD
    TABLE VOY
    INTVCN VCN
    10 TEST
    TABLE BL
    VCN BL
    10 200
    10 201
    TABLE SUBBL
    subbl     bl     subbl     ccd     qty
    100     200     s1     c1     100
    101     200     s2     c1     60
    102     200     S3     C2     20
    103     201     s1     c1     40
    104     201     s2     c1     20
    TABLE DCD
    crg_seq_no     subbl     qty      weight
         1     100     50     
         2     100     25     
         3     101     30     
         4     101     20     
         5     102     20     
         6     103     20     
         7     103     10     
         8     104     20     
    Following query was executed but we are getting wrong sum for qty (SUBBL)
    Query
    select d.ccd,sum(d.qty),sum(f.qty) from
    (Select distinct a.ccd,a.subbl,a.qty from subbl A, bl B, voy C
    Where a.bl = b.bl and b.vcn = c. intvcn and c. vcn = 'TEST') D,subbl E, dcd F
    where d.ccd = e.ccd and d.subbl = e.subbl and d.subbl = f.subbl
    group by d.ccd
    Result
    CCD SUM(D.QTY) SUM(F.QTY)
    C1 420 175
    C2 20 20
    Expected result
    CCD SUM(D.QTY) SUM(F.QTY)
    C1 220 175
    C2 20 20

    Hi,
    This query is OK with you.
    But i don't know why you use distinct in first inline view
    select d.ccd,sum(d.qty),sum(f.qty) from
    (Select distinct a.ccd,a.subbl,a.qty from subbl A, bl B, voy C
    Where a.bl = b.bl and b.vcn = c. intvcn and c. vcn = 'TEST') D,
    (select subbl,sum(qty) qty from dcd group by subbl) F
    where d.subbl = f.subbl
    group by d.ccd
    Bye
    Chitta

  • Hi All sum of qty

    hi all,
    i want to display the quantity sum of  bill of materials line item in the title udf total_qty.
    is it possible .
    awaiting soon reply
    Rajkumar

    to the title UDF add FS as
    select coalesce(sum(quantity),0) as qty1 from ITT1 T0 where T0.Father = $[OITT.CODE]
    Edited by: Petr Verner on Dec 22, 2008 2:31 PM

  • Managing exceptions in SQL

    Please assist with this little puzzle.
    Imagine 2 tables... Products and Stock tables.
    Products has columns:
    Product_no
    Site
    Status
    Stock has columns:
    Product_no
    Site
    Location
    Qty_on_hand
    Sample data:
    Products:
    1000,MFG,A
    1000,SRV,D
    1000,DEM,A
    1001,SRV,D
    1001,DEM,O
    1002,MFG,A
    1002,DEM,A
    1003,MFG,D
    1003,SRV,D
    1004,MFG,A
    1005,MFG,D
    1005,SRV,D
    1005,DEM,D
    1006,MFG,D
    1007,MFG,D
    1007,SRV,D
    1008,MFG,D
    1008,SRV,D
    1009,MFG,D
    And the Stock table:
    1000,MFG,BAY1,1
    1000,SRV,BAY1,0
    1000,DEM,A,BAY2,0
    1001,SRV,D,BAY1,0
    1001,SRV,D,BAY2,0
    1001,DEM,A,BAY1,0
    1002,MFG,A,BAY1,0
    1002,DEM,A,BAY2,0
    1003,MFG,D,BAY1,0
    1003,SRV,D,BAY1,0
    1004,MFG,A,BAY1,0
    1005,MFG,D,BAY1,0
    1005,DEM,D,BAY1,0
    1006,MFG,D,BAY1,0
    1007,MFG,D,BAY1,5
    1007,SRV,D,BAY1,100
    1008,MFG,D,BAY1,1
    1008,SRV,D,BAY1,0
    So, a product can exist in multiple sites and can have a status of A(ctive), O(bsolete), D(iscontued) or P(lanned).
    There may or may not be stock for the product, or even a row entry (eg 1009).
    The stock table has the part which can be in multiple sites and each site has multiple locations.
    The sum of qty on hand at product/site level gives the total qty on hand for that product/site, of course.
    That is the background.
    What I need to report is...
    Product_no
    Site
    from Product
    where
    the product across all sites is D
    and
    the qty on hand across all sites is 0 (ie there isn't any)
    So I think the results I would expect are:
    1003,MFG
    1003,SRV
    1005,MFG
    1005,SRV
    1005,DEM
    1006,MFG
    1009,MFG
    ...BECAUSE
    1000 has non-D status (2 actually)
    1001 has non-D status
    1002 has non-D status (2)
    1003 are both D, sum qty on hand is 0, so OK
    1004 has non-D status
    1005 are all D, sum qty on hand is 0, so OK (one stock is missing, so assume 0)
    1006 is D, sum qty on hand is 0 so OK
    1007 are both D, sum qty on hand 105 so NOT OK
    1008 are both D, sum qty on hand 1 so NOT OK
    1009 is D and there is no stock, so assume 0 so OK
    I can't seem to get my head around coding without using a multitude of double negatives! Any ideas, please?

    Hello
    It think this is right. Your test data for stock had the status column which I assumed to be a mistake....
    CREATE TABLE dt_test_Products
    Product_no     number,
    Site     varchar2(3),
    Status     varchar2(1)
    create table dt_test_Stock(
    Product_no     number,
    Site     varchar2(3),
    Location     varchar2(4),
    Qty_on_hand     number
    INSERT INTO dt_test_products VALUES(1000,'MFG','A');
    INSERT INTO dt_test_products VALUES(1000,'SRV','D');
    INSERT INTO dt_test_products VALUES(1000,'DEM','A');
    INSERT INTO dt_test_products VALUES(1001,'SRV','D');
    INSERT INTO dt_test_products VALUES(1001,'DEM','O');
    INSERT INTO dt_test_products VALUES(1002,'MFG','A');
    INSERT INTO dt_test_products VALUES(1002,'DEM','A');
    INSERT INTO dt_test_products VALUES(1003,'MFG','D');
    INSERT INTO dt_test_products VALUES(1003,'SRV','D');
    INSERT INTO dt_test_products VALUES(1004,'MFG','A');
    INSERT INTO dt_test_products VALUES(1005,'MFG','D');
    INSERT INTO dt_test_products VALUES(1005,'SRV','D');
    INSERT INTO dt_test_products VALUES(1005,'DEM','D');
    INSERT INTO dt_test_products VALUES(1006,'MFG','D');
    INSERT INTO dt_test_products VALUES(1007,'MFG','D');
    INSERT INTO dt_test_products VALUES(1007,'SRV','D');
    INSERT INTO dt_test_products VALUES(1008,'MFG','D');
    INSERT INTO dt_test_products VALUES(1008,'SRV','D');
    INSERT INTO dt_test_products VALUES(1009,'MFG','D');
    INSERT INTO dt_test_stock VALUES(1000,'MFG','BAY1',1);
    INSERT INTO dt_test_stock VALUES(1000,'SRV','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1000,'DEM','BAY2',0);
    INSERT INTO dt_test_stock VALUES(1001,'SRV','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1001,'SRV','BAY2',0);
    INSERT INTO dt_test_stock VALUES(1001,'DEM','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1002,'MFG','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1002,'DEM','BAY2',0);
    INSERT INTO dt_test_stock VALUES(1003,'MFG','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1003,'SRV','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1004,'MFG','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1005,'MFG','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1005,'DEM','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1006,'MFG','BAY1',0);
    INSERT INTO dt_test_stock VALUES(1007,'MFG','BAY1',5);
    INSERT INTO dt_test_stock VALUES(1007,'SRV','BAY1',100);
    INSERT INTO dt_test_stock VALUES(1008,'MFG','BAY1',1);
    INSERT INTO dt_test_stock VALUES(1008,'SRV','BAY1',0);
    SELECT
         product_no,
         site
    FROM
         SELECT
              a.product_no,
              a.site,
              SUM(NVL(b.qty_on_hand,0)) OVER(PARTITION BY a.product_no ORDER BY a.product_no) prod_qty,
              COUNT(DECODE(a.status, 'D',NULL, 1)) OVER(PARTITION BY a.product_no ORDER BY a.product_no) stat_count
         FROM
              dt_test_products a,
              dt_test_stock b
         WHERE
              a.product_no = b.product_no (+)
         AND
              a.site = b.site (+)
    WHERE
         prod_qty = 0
    AND
         stat_count = 0 HTH
    David

  • Order qty and confirmed qty mismatch

    Dear friends,
    My requirement is System should not allow to go further if the sale order qty and confirmed qty(after avaialbility check) mismatch is there.Pls suggest.
    Now currently system will check the availability qty and will show the information of confirmed qty in the another screen.and if we say continue the process, we can go ahead and save the document.but the document will be in open state.
    So pls suggest the way i can go ahead for this requirement.
    Regards
    Mahendar.

    hi,
    If u want to allow user to create SO as much as available qty..? means  system sud create SO for order qty is equal to availble qty ...? if yes
    then go the availbality check  and find out availability check and checking rule..
    and again go to OVZ9 remove the check box check with out RLT from rep.lead time tab
    Resul is: If u enter in SO a10 qty ,and if you have only 5 qty in hand or in plant ,then system after checking the items it will change the order qty in SO(i e 5) automatically,
    Caprin

  • How to Sum the datafield of a sub-group?

    Post Author: [email protected]
    CA Forum: General
    Hello guys,
    I am having this issue that I want to only Sum the datafield at sub-group level, not the detail level. But when I do the sum, it is adding all the details. The reason I am having this is because I have somewhat duplicated details (they complement each other). I merge them using group (by Item). The Item QTY is the feild that they all have and they have the same value, but I only need one of them. Now I want to group them by order number and show the total of items I ordered. I Sum all the items' QTY, but instead of sum the QTY that's merged, it sums all the QTY from detail. Basically I am suming duplicate numbers.
    Is there any solution to this? Thank you.

    Post Author: [email protected]
    CA Forum: General
    Hello Jagan,
    Thank you for the help. I treid the Average running total, but the problem is that I cannot do Summary on those new fields on the parent group. Also I can't get rid of the dupliate because the singel record does not contain enough info, I need all the records to merge togather to collect all the required inforamtion. Before I will just created a merged view on my DB to get rid of duplicate records. But this time, I am linking too much tables (includes external server DB table) that I can't make a view for that.
    Basically I have an order that splits into multiple invoices that get shipped using an external server where the Actual Ship Date does not write back to our own ordering system. I am trying to see if all my items are ship on time. So I need to merge all the items QTY from invoices that linked with external shipping DB, and group them in one order.
    The main problem I have is that I can't do summary on many custome fields. I can made the correct amount using Formula Field that has a shared flag to not include duplicate numbers. But once I use the shared flag, the forumla is no longer useable by Summary.
    Anyway, I think I will just use Excel instead. I already have all the proper data, just that when I do group summary in Crystal, it becomes a problem. I will export the data and do analysis from there.
    Thank you for the help

  • How to get sum from max value

    Hi Experts
    I stuck with small problem ,any one please solve the problem i appreciate ur help
    Below is my table , i need to get maximum operation i..e from order 10 the maxi operation is #/02 and for order 20 operation is  #/01 . and i need to sum it up for respective operations Actual qty values ..
    Ext material grp  Order Number   Operation key    Actual Qty
    100 A.H               10                 #/01             200
    100A.H                10                  #/02            300
    100 A.H               20                 #/o1             100  
    100 A.H               30                 #/02             400
    i want to show the table like
                           Operation Keys
    Ext material grp        10         20    
    100A.H                  100        700(300+400 )  
    All Objects from same dataprovider,
    Please help me on this .

    Hello,
    I am having some difficulty interpreting your requirement. You say:
    I need to get maximum operation i..e from order 10 the maxi operation is #/02 and for order 20 operation is #/01
    Is the output you described more likely to look like that below?
    Ext material grp.....  Order Number.....Operation key.....Actual Qty
    100 A.H.........................10....................... #/02.............. 500 (200 + 300)
    100 A.H........................ 20....................... #/01...............100  
    100 A.H........................ 30....................... #/02...............400
    If so, you could use extended syntax to pull back the max operation key and actual qty sum in the context of each ext material grp, order number combination (or whatever dimensions are needed to give you the grain needed). EG
    max operation key = max (operation key) in (ext material grp; order number)
    sum actual qty = sum(actual qty) in (ext material grp; order number)
    Hope this helps
    Jacqui

  • Best practice for creating a sum of a formula?

    What is the best way to create a sum on multiple groups from a formula or another sum?
    Sum ({IC_ADJS_JNL.QTY}, {IC_ITEM_MST.ALT_ITEMB}) * {NT_CONV_FCT.NET} - This is sitting in GF1, but I also need the sum of this on GF2.
    {NT_USED_DEM.USAGE_QTY} - {@RPK_LBS} - another example sitting in GF1 but needs its sum in GF2
    Hopefully I have explained this well enough. Thanks in advance for your help!

    You can create make use of global variable, the logic is similar to running total.
    What you do is:
    1. You initialize a global variable.
    Whileprintingrecords
    numbervar gcount::=0;
    2. You accumulate the variable at the section you want.
    Whileprintingrecords;
    numbervar gcount;
    gcount:=gcount + xxxx
    If you need certain condition, just use if statment like normal.
    3. To display the global varaible
    Whileprintingrecords;
    numbervar gcount;

  • Best way to select from 2 tables, based on sum from detail table

    I have a "customer order line detail" table from which I want to report
    Order Number
    Customer Number
    Part Number
    Line Value { which is Unit Qty * (Unit price - discount%) }
    But only for orders which are above £1500.
    And lines which are not "Cancelled"
    I have access to an API which returns the total order value for the order.
    I am currently using this in my criteria, eg:
    select order_no, customer_no, part_no, round(unit_qty *(unit_price - unit_price *(discount/100)),2) Line_value
    from customer_detail
    where
    status != 'Cancelled'
    and
    Customer_Order_API.Get_Total_Sale_Price__(order_no)>=1500
    The API contains the following:
    SELECT SUM(ROUND((qty * price_conv_factor * unit_price), rounding_) -
    ROUND((qty * price_conv_factor * unit_price) -
    ((qty * price_conv_factor * unit_price) * ((1 - discount / 100) * (1 - order_discount / 100))), 2))
    FROM customer_detail
    WHERE order_no = order_no_
    AND state != 'Cancelled'
    AND line_item_no <= 0
    (that uses a price conversion factor that I don't use, since it's always 1)
    My query runs so slowly, because it is getting the order value for every line of the order, is it possible to improve?
    Thanks

    Thanks for the suggestion, it was close to what I needed.
    I ended up with this:
    select order_no,  name, ref_id, c_salesman_sub_division, line_value, catalog_desc
    from
    (SELECT coj.customer_no, coj.order_no, ifsapp.customer_info_api.GET_NAME(customer_no) name, coj.ref_id,
           coj.c_salesman_sub_division, ROUND((coj.buy_qty_due * coj.
           price_conv_factor) * coj.sale_unit_price, 2) - ROUND((coj.buy_qty_due *
           coj.price_conv_factor) * coj.sale_unit_price - ((coj.buy_qty_due * coj.
           price_conv_factor) * coj.sale_unit_price) * ((1 - coj.discount / 100) *
           (1 - coj.order_discount / 100)), 2) line_value, coj.catalog_desc,
    SUM( ROUND((coj.buy_qty_due * coj.
           price_conv_factor) * coj.sale_unit_price, 2) - ROUND((coj.buy_qty_due *
           coj.price_conv_factor) * coj.sale_unit_price - ((coj.buy_qty_due * coj.
           price_conv_factor) * coj.sale_unit_price) * ((1 - coj.discount / 100) *
           (1 - coj.order_discount / 100)), 2)) OVER (PARTITION BY Coj.ORDER_NO) AS SUM_ORDER
        FROM ifsapp.customer_order_join coj
        WHERE coj.order_no = coj.order_no
          AND TRUNC(coj.date_entered) = NVL(TO_DATE('25/01/2007', 'DD/MM/YYYY'),
              TRUNC(SYSDATE))
          AND coj.authorize_code = 'UKMEDM'
          AND coj.line_item_no >= 0
          AND coj.ref_id <> 'SAMP'
          AND coj.state <> 'Cancelled'
    where sum_order >=1500
        ORDER BY ref_id, c_salesman_sub_division, customer_no, order_no
    /[pre]
    But I have realised the problem with this.  Not sure if I made it clear, to myself even, but I need to include
    order lines added on a particular day (that are not cancelled)
    for orders which total >= £1500.
    If one line of an order is added for £900 but the rest of the order is £2000 then that line should be shown.
    My SQL only shows lines added for the day >= 1500.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • DAX Sum of children

    Hi guys,
    I'm working on a SSAS 2012 Tabular Model and am running into some difficulties with one of my measures.
    What my setup looks like:
    Dim Time hierarchy: Year - Season (Quarter) - Month
    Fact Forecast: Account - Material - Month - Forecast Quantity - Bookings Quantity
    I now need to calculate the Forecast accuracy but scoped to the period shown.
    On a Month level, this is working by doing the following:
    Forecast Accuracy:=1- (SUMX('Forecast',ABS(Forecast Quantity - Bookings Quantity))/Forecast Quantity)
    My problem here starts on a higher grain, like Season or Year.
    The biggest problem here is this part:
    ABS(Forecast Quantity - Bookings Quantity)
    Both quantities should first be aggregated to Account - Material - <Period> level and then subtracted from eachother but I'm not able to get this to work.
    Has anyone encountered this before because I don't have a clue how to solve this after crawling the web for half a day...
    Kind regards,
    Jan

    Hi Marco,
    Thanks for your response, I first tried implementing the Forecast Error by slightly altering the measure as you suggested:
    Forecast Error:=
    SUMX (
    VALUES ( Time[Business Season] ),
    CALCULATE (
    ABS (
    SUM ( [Forecast Qty] ) - SUM ( [Bkgs Qty])
    However, this does not give me the correct information either...
    On the lowest level this works as expected like my measures tried beforehand.
    Once I start rolling up, the calculations are happening incorrectly.
    For example, in the image below, for the account *test* it gives Forecast Error 76450 total, but should return 482152 which is the sum of all the values on the lowest level (entire range selected in Excel here for demonstration).
    Any thoughts on this?
    Kind regards,
    Jan

  • Reg: i want to get total qty of partculary month

    Hi All,
    i have developed a report
    the output fields are material,plant and qty.
    my requirment is for that material and plant what is the total qty in that month
    who to sum the qty?
    example is
    material       plant      qty
    10000023    4210       1
    10000023    4210       2
    10000023    4210       3
    But i want get like this
    material       plant      qty
    10000023    4210      6
    please can you help
    thanks
    kavi

    Try this sample code..
          Sort I_ZQMBW_FUJ_VENDQFR by MATNR PLANT
          LOOP AT I_ZQMBW_FUJ_VENDQFR INTO WA_DATA.
            AT END OF MATNR.
              LOOP AT I_ZQMBW_FUJ_VENDQFR INTO WA_DATA WHERE LIFNR = WA_DATA-MATNR.
                V_COUNT = V_COUNT + 1.
                AT END OF PLANT.
                  WA_DATA-TOTAL_QFR = V_COUNT.
                  MODIFY I_ZQMBW_FUJ_VENDQFR FROM WA_DATA  TRANSPORTING TOTAL_QFR   
                                                                    WHERE MATNR = WA_DATA-MATNR
                                                                       AND   MTH = WA_DATA-MTH.
                  CLEAR V_COUNT.
                ENDAT.
              ENDLOOP.
            ENDAT.
          ENDLOOP.
    Hope this helps...

  • Sum problem of rows because of column

    Problem...
    I have 2 row groups
    Year and QTY
    for every Year (2003,2004 etc) there are a number of cities with their own QTY
    For instance
    City1 has QTY = 20 for Year 2003
    City2 has QTY = 30 for Year 2003
    When I sum only one City1 I want the column QTY to show 20 for Year 2003 and to show 50 if both City1 and City2 are selected.
    The problem is when I sum let say City 1 it shows me 100 instead of 20 because the column group consists of 5 rows in dataset query with QTY 20, so if I sum 2 cities of the same Year it will give me 100(City1) + X(City2).   
    Did it make sense or do you need more input?

    Hi Jhonny86,,
    According to your description, you want to sum the [Qty] values for based on the selected values in the parameter.
    In your scenario, you can use DISTINCT keyword to return only distinct (different) values in query designer. Then create a tablix group on [Year] and create a city parameter. Please refer to screenshots below:
    If report deisgn above doesn't meet your requirements, please share sample data and expected results for our analysis.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • User LIS average ratios instead of sum

    Hi guys,
    Im creating a user LIS, i know that when creating LIS on MC21 there is flag with indicates if its reasonable to add the values on this ratio, and i need to know if by any chance instead of adding the rations on LIS, system can make an average of them. See in LIS MCI7 system calculate MTBF & MTBR and average them, how can i make that with a user created ratio.
    Thanks.

    Hello,
    Plese see below the correct syntax for the SUM function
    The following examples are applicable to both Basic and Crystal syntax:
    Sum({file.QTY})
    Calculates the sum of all values in the QTY field.
    Sum({orders.AMOUNT}, {orders.CUSTOMER ID})
    Sums (totals) the orders in each group of orders in the Amount field. The orders are separated into groups whenever the value in the Customer ID field changes.
    Sum({orders.AMOUNT}, {orders.DATE}, "monthly") % Sum({orders.AMOUNT })
    Groups values in the Amount field by month, and calculates the sum of the values for each month group as a percentage of the sum of the values for the entire report.
    Sum([{file.AMOUNT}, {file.PRICE}, {file.COST}])
    Sum of values in the Amount, Price, and Cost fields.

  • Report error (avg could not be 0) amount / qty = rate

    hi guys
    i need sum of amount divied by sum of quantity
    but when i use this formula
    sum(nvl(amount,0))/sum(nvl(qty,0)) as "Avg"
    its give me error
    divider could no be 0
    Regards
    Shahzaib ismail

    You can use "HAVING" clause where you are selecting the quantity, which can be
    having sum(qty)>0
    Regards
    Naveed

  • How to get two Results  - Sum and Average for one KeyFigure

    I have "Material" in Rows and "Cal Year/Month" in Columns and also KeyFigure "Qty" in Columns.
    The Results (Yellow) of "Qty" is defined as "Avg of all values <>0". This works fine but how do I get two Results - one is a "Sum" and the other "Avg" for just one KeyFigure. The output basically should look like below:
          Cal Yr/Month  01/2006   02/2006   03/2006...    Result        Result
    Material                   Qty       Qty           Qty       Sum of Qty   Avg of Qty
    ABC                       100         0             200            300             150     
    DEF                       100         200          300            600             200     
    GHI                        500         300          400           1200            400

    Hi Srinivas,
    I think you must use Restricted Key Figures and Formula.
    Do not introduce CALMONTH in columns, but restrict 12 times the Key Figure Qty with 0CALMONTH3, that is 01-02-03-...
    Then create a Formula that is the Sum of all Restricted KF and call it SUM.
    Then copy the previous Formula (SUM) and call it AVG and give the option of Average of all Values <>0.
    Try.
    Ciao.
    Riccardo.

Maybe you are looking for