How to calculate moving average price(MAP) when price variance in IV

Hi All,
My current stock for a material is 39 and MAP is 0.8 GBP.
A purchase order is created for the material for a quantity of 1 at price of 0.8 GBP per unit.
Invoice is posted for the above PO at price of 1.74 GBP.
What will be the new MAP for the material now??How to calculate MAP when there is a price variance in Invoice?
Please suggest ASAP.

Hi,
The Procedure for calculating MAP is :-
Case 1 :- PO at different price
If in Material Master your MAP is 0.8GBP & closing stock of 30Nos, value is 24GBP
In PO if the price is 0.9GBP & qty is 10nos, then after Goods Receipt Total Value of the GR i.e. Qty * Price + any other delivery cost will be added to the material stock value.  Qty is also updated.  New Total Value / New Stock Qty will be MAP.
In this case Qty received 10 & price is 0.9 that means value would be 9GBP.
Total Value becomes 24GBP (Present Stock) + 9GBP (Goods Receipt) = 33GBP
Total Qty becomes 30Nos + 10Nos (Goods Receipt) = 40Nos
MAP becomes = 33GBP / 44Nos = 0.75
Case 2 : Invoice Posting (MIRO) at different price than PO
While doing MIRO is we post at different price system will check whether sufficient stock posted in GR is available.  In the above case it is 10Nos,
If it is there, then the above logic as in case 1 will take place
If not available, to the extent of stock availability system will post the different value & adjust MAP & remaining is posted to Price Difference Account.
In your case it would be like this :
1. MAP 0.8 for 30Nos (Value would be 24GBP)
2. Invoice Posting 1.74GBP for 1No.  That means value would be 24GBP + 1.74GBP = 25.74GBP
     Qty would be 30+1 = 40
     MAP = 25.74 / 40   = 0.64GBP
Hope this clarifies your doubt
regards,
JP

Similar Messages

  • How to calculate moving average price?

    hi,
    i need someone to explain to me how to calculate moving average price

    Hi,
    Follow the Link,
    Re: moving average price

  • How to get Moving Average Prince and Standard Price in BW (inventory cube).

    Hi All,
    Could anyone please suggest us how to get Moving Avg. Price and Standard Price for 0ic_c03 cube, i had gone through 0CO_PC_ACT_05 and 0CO_PC_ACT_02 datasource but it is not going to solve our purpose.
    In SDN i had gone through few links and understood that we have to work on 0MAT_PLANT info object but i hav't not found how to work on this, though i found few SAP notes which are related to MAP. (869892, 819464, 863644).
    Probably some one might worked on these MAP and Std. Price, if you could share your work which us that will be a greate help.
    Highly appreciated if you share the code and steps how to work on MAP and Std. Price.
    Thanks in Advance.
    Akash

    Hi,
    You need to enhance the Standard DS of Infoobject 0MAT_PLANT and Infoobject 0MAT_PLANT  to include these 2 fields.
    And you need to enahance the 0IC_C03 cube to include  0MAT_PLANT and need to complete the mapping in all 3 Update rules for this added Infoobject.
    <b>And you need to upload the attribute data of 0MAT_PLANT as full upload every day.</b>
    In the reports , you need to dependent on Formula varibles with replacement path with standard price an MAP price attributes of  0MAT_PLANT. So if you go with these formula variables with replacement path, you should take 0MAT_PLANT characterstic into rows as a prerequiste.
    If you want to  avoid this prerequisite, then take a look on How to calculate with attributes values.
    Other wise you need to do the calculations at 0MAT_PLANT level by a base query after every upload,and the result should be stored in TODS by APD .And then you can final report with out 0MAT_PLANT in rows upon this ODS.
    You can see my contact details in my business card.
    With rgds,
    Anil Kumar Sharma .P
    Message was edited by:
            Anil Kumar Sharma

  • How to get Moving Average Price ( MAP ) & Standered Price in BW

    Hi all,
    I want to get the Moving Average Price ( MAP) & Standered price in BW Report.So that please suggest me
    1. which Cube I have to use &
    2.  which datasource having that Moving Average Price ( VERPR) Field.
    If having other Procedure to calculate Moving Average Price in BW .
    please give me these details.
    Thanks,
    kiran

    Hi Kiran,
    0IC_C03 Cube can be used to bring the fields you require.
    Please search forum post by Anil Kumar, link is not available  thats why i am copying the text here.
    You need to enhance the Standard DS of Infoobject 0MAT_PLANT and Infoobject 0MAT_PLANT to include these 2 fields.
    And you need to enahance the 0IC_C03 cube to include 0MAT_PLANT and need to complete the mapping in all 3 Update rules for this added Infoobject.
    And you need to upload the attribute data of 0MAT_PLANT as full upload every day.
    In the reports , you need to dependent on Formula varibles with replacement path with standard price an MAP price attributes of 0MAT_PLANT. So if you go with these formula variables with replacement path, you should take 0MAT_PLANT characterstic into rows as a prerequiste.
    If you want to avoid this prerequisite, then take a look on How to calculate with attributes values.
    Other wise you need to do the calculations at 0MAT_PLANT level by a base query after every upload,and the result should be stored in TODS by APD .And then you can final report with out 0MAT_PLANT in rows upon this ODS.
    please see this links
    Re: 2lis_03_um and MBEW- STPRS
    Re: How to get Moving Average Prince and Standard Price in BW (inventory cube).
    Hope this Helps.
    Thanks
    CK

  • How change the moving average prices?If run costing done In the MR21 system

    hI,
    How change the moving average prices?If run costing done In the MR21 system notallowing the changing the prices?
    Regards
    Channa

    Hi
    Showingerror
    A current or future standard price exists for material 300000007
    Message no. CKPRCH025
    Diagnosis
    A current or future cost estimate exists.
    Procedure
    You can set the price of a marked cost estimate through the radio button 'Default Planned Prices' and release it by saving.
    Please what is the process changing moving aveerage prices

  • How to calculate the average inventory in ABAP

    Dear All,
    Please find the below formula and this formula how to calculate the Average inventory at value.Please let me know the abap base tables and the corresponding fields.
    Formula
    Inventory Turnover = Cost of Goods Sold (COGS) / Average Inventory at value.
    Thanks
    Regards,
    Sai

    Hi Arivazhagan,
    Thanks for your quick response .
    The field MBEWH from the table is fulfill the average inventory at value.
    For Eg :I want to calculate Inventory Turnover = Cost of Goods Sold (COGS)/
    Average Inventory at value.
    so shall i take Inventory Turnover = Cost of Goods Sold (COGS)/MBEWH
    The above formula will meet my requirement to find the average inventory Turnover.
    Thanks
    Regards,
    Sai

  • How to change moving average price with movement type 501

    Hi Gurus,
                         Our client procures stock item with P-Card and use the movement type 501 to receive into the stock. The value of these items are updated with the moving average price, most of the time the current purchase price is different than current moving average price, so client wants to change the moving average at the time of receiving the goods into the system. Can some one explain is it possible or not. If possible how can we adjust the price? Client doesnu2019t want to go modify the price with other transaction. They want to modify while receiving with MIGO.
    Thanks,
    Vikram

    Hi
    You need to goto transaction OMJJ, select the movement type as 501.
    Then double click on "Field selection-Enjoy transaction".
    Add the field EXWBR & make it optional.
    Now when you goto MIGO & enter 501 movement type you will find the Ext amount in LC field on Quantity tab page.
    Enter the amount in this field during the GR.
    Regards
    Prasad

  • How to get moving average price in 0ic_c03 with back dating

    Hi all,
            The stock overview report in 0IC_C03 gives stock values based on Purchase value where as i need to calculate the stock value based on Moving average price, (so that it tallies with R/3 std report MB52), also need to get the stock value for backdating also i.e like MB5B standard report in R/3.
      <removed by moderator>
    Thanks & Regards
    Suresh Putta & Ravi Y
    Edited by: Siegfried Szameitat on Jan 19, 2009 12:12 PM

    Hi,
    The stock overview report in 0IC_C03 gives stock values based on Purchase value where as i need to calculate the stock value based on Moving average price, (so that it tallies with R/3 std report MB52)
    --> Need to enhance 0IC_C03 for moving average price and need to multiple Quantity with price to get value. You can do this at extraction level(Transformation / update rules) or Query level.
    also need to get the stock value for backdating also i.e like MB5B standard report in R/3.
    Or Maintain material price as Material attribute and create a multiprovider on 0IC_C03 and Material and calculate value at query level. In this approach value getting derived based on available price only(means historic values may change if price changing over period of time).
    Srini

  • How to calculate an average of YTD measures?

    Hi all,
    I'm working on BPC 10 for NW.
    We use an account-type dimension for Personnel inventory (Personnel to fixed-term contracts, to permanent contracts, number of executives, staff etc.).
    The corresponding ACCTYPE is AST because people are seen as a balance sheet account measure. So the measure, even if we're in periodic in our model, is stored as a YTD value.
    I want to calculate a average with those measures, for instance the average number of contractors from january to the current month, with a member formula. I can't manage to do that with a calculation because I can't add values of YTD measures: when I try a formula like ([ACCOUNT].A1 , [MEASURES].[YTD]) it returns the same value as the periodic value. Whereas the formula works with EXP account type.
    The formula I'd like to have in the end would be something like that:
    iif(isleaf([TIME].currentmember),avg(YTD(),([Measures].[PERIODIC],[ACCOUNT].[G102])),[TIME].currentmember.lastchild),solve_order=5
    This formula works in a previous version of BPC (5.1) but not in BPC 10.
    Any idea?
    Thanks very much,
    Sébastien.

    Assuming the job always starts at mid-might, you can try something like this:
    WITH t AS
    (SELECT to_date('01-JUL-2011 07:25:31', 'dd-mon-yyyy hh:mi:ss') AS end_date
    FROM dual
    UNION
    SELECT to_date('02-JUL-2011 07:10:58', 'dd-mon-yyyy hh:mi:ss') AS end_date
    FROM dual
    UNION
    SELECT to_date('01-AUG-2011 07:16:24', 'dd-mon-yyyy hh:mi:ss') AS end_date
    FROM dual)
    SELECT trunc(end_date, 'mon') AS MONTH,
            trunc(end_date, 'mon') + avg(end_date - TRUNC(end_date)) AS AVERAGE_TIME
    FROM t
    GROUP BY TRUNC(end_date, 'mon');

  • How do calculate the average of a group of percentages excluding percentages listed as zero on Numbers?

    Hey all
    This is driving me crazy!
    I need to calculate the average of a group of percentages excluding cells listed as '0%'.
    Please see screen print below, numbers highlighted need to be averaged, when the table is filled out correctly some will remain '0%' whilst others will have a value, I want the average to be calculated only using numbers with a value greater than '0'.
    FYI I am looking for the result to display in 'X2'
    Thanks :-)

    you can use the averageif() function. Here is a simple example to get you started:
    In this example the average if() function averages values that are non-zero
    C2=AVERAGEIF(A1:E1,"<>0",A1:E1)
    this is shorthand for select cell C2, then type (or copy and paste from here) the formula:
    =AVERAGEIF(A1:E1,"<>0",A1:E1)

  • How to change Moving average price in accouting view at valuation cat level

    Hi,
    We are loading Material Master data for one client. We are using LSMW to load this object
    We have uploaded u201CMoving Price (MBEW-VERPR)u201D in Accounting 1 view at valuation category level. Unfortunately incorrect value has been loaded Is it possible to change??
    We donot have stock for this materials.
    When I tried to do this using MM02, I understand that itu2019s grayed out field and cannot be changed in second attempt.
    Let me know if there is any other procedure to handle the situation??
    Rajesh Chavan

    Hi
    You can change the same through MR21
    regards
    Sanil

  • Help..! ..how to calculate the average interest rate in discoverer?

    help..!
    I want to calculate average interest rate in discoverer, question describes below:
    1. the data have 4 columns, 1 account number, 2 balance, 3.interest rate, 4. product type 1, product type 2
    2.average interest rate =
    sum (product type1 account bal * rate / sum(product bal)).
    a*sum(product bal) is sum every records column 2 according the type of product
    b*every record need to calculate using balance to divide sum(product bal) for calculate the rate of the sum(product bal) of type of product
    c* sum(b*) is what my answer rate.
    3.
    I need to display average interest rate in discoverer, and each product have a one average rate according user drill-up or drill-down product dimension.
    *product dimension have two level
    please tell me how to let every record divide by group sum(product bal)
    or tell me how to solve this problem.
    thanks!
    david

    Hi David
    Try using the AVG analytic function.
    Best wishes
    Michael

  • How to calculate this average cost ?

    Hello,
    I've been thinking on this for problem for a while, but could not come up with a solution. In excel it is easy to do, but in SQL ?
    Tried with analytics but no success.
    I need to recalculate the AVG_PRICE when QUANTITY > 0, ie when I buy, else AVG_PRICE = prior AVG_PRICE.
    these are the rules:
    QTY_ON_HAND is a running total of QUANTITY
    TOTAL_COST = AVG_PRICE * QTY_ON_HAND
    AVG_PRICE = ( TOTAL_COST (preceding row) + TRADE_AMOUNT (current row) ) / QTY_ON_HAND
    Group is FUND_CODE, INSTRUMENT_TYPE, INSTRUMENT_CODE
    Order is by TRADE_DATE
    the numbers I need are on the last row of the .CSV file
    AVG_PRICE = 797.0237644
    QTY_ON_HAND = 1'327.137600
    TOTAL_COST = 1'057'760.21
    Any help is more than welcome
    thank you
    Claudio
    this is the data:
    CREATE TABLE t (
    "FUND_CODE" NVARCHAR2(3),
    "INSTRUMENT_TYPE" NVARCHAR2(4),
    "INSTRUMENT_CODE" NVARCHAR2(15),
    "TRADE_DATE" TIMESTAMP,
    "QUANTITY" NUMBER,
    "TRADE_AMOUNT" NUMBER
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-10-2007 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 115.2502, -92411.183116);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('05-12-2007 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 318.4801, -336101.285453);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('11-01-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -64.6781, 67647.083502);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('25-01-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 72.5117, -109197.254334);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-02-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 87.1223, -123386.870253);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('29-02-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 110.869, -93957.707954);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('06-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -55.2563, 49721.994761);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('12-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 164.4146, -135834.245667);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('18-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -37.6276, 41342.685831);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('27-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 159.1288, -112293.21594);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-05-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 64.6638, -46458.289084);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('23-05-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 137.3465, -85979.32104);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('04-06-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 156.0562, -86183.26);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-07-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -342.5453, 265491.46);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('11-08-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -175.8868, 170185.92);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('26-08-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 143.9074, -124927.73);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('28-10-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -321.3085, 472031.39);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('03-11-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -85.2822, 73202.14);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 38.1563, -27117.03);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('02-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 168.331, -135004.83);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('04-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 606.1362, -461853.36);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('10-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 67.3483, -47610.26);
    COMMIT;
    this is the result in .CSV format, so that you can "see it" in a spreadsheet
    FUND_CODE;INSTRUMENT_TYPE;INSTRUMENT_CODE;TRADE_DATE;QUANTITY;TRADE_AMOUNT;AVG_PRICE;QTY_ON_HAND;TOTAL_COST
    CLF;ifus;CLCX;01.10.07;115.250200 ;-92411.18312;801.831;115.250200 ;92'411.18
    CLF;ifus;CLCX;05.12.07;318.480100 ;-336101.2855;987.9698711;433.730300 ;428'512.47
    CLF;ifus;CLCX;11.01.08;-64.678100 ;67647.0835;987.9698711;369.052200 ;364'612.45
    CLF;ifus;CLCX;25.01.08;72.511700 ;-109197.2543;1073.02637;441.563900 ;473'809.71
    CLF;ifus;CLCX;01.02.08;87.122300 ;-123386.8703;1129.586093;528.686200 ;597'196.58
    CLF;ifus;CLCX;29.02.08;110.869000 ;-93957.70795;1080.679646;639.555200 ;691'154.29
    CLF;ifus;CLCX;06.03.08;-55.256300 ;49721.99476;1080.679646;584.298900 ;631'439.93
    CLF;ifus;CLCX;12.03.08;164.414600 ;-135834.2457;1024.790089;748.713500 ;767'274.17
    CLF;ifus;CLCX;18.03.08;-37.627600 ;41342.68583;1024.790089;711.085900 ;728'713.78
    CLF;ifus;CLCX;27.03.08;159.128800 ;-112293.2159;966.4362121;870.214700 ;841'007.00
    CLF;ifus;CLCX;01.05.08;64.663800 ;-46458.28908;949.2840914;934.878500 ;887'465.29
    CLF;ifus;CLCX;23.05.08;137.346500 ;-85979.32104;907.8734486;1'072.225000 ;973'444.61
    CLF;ifus;CLCX;04.06.08;156.056200 ;-86183.26;862.6915958;1'228.281200 ;1'059'627.87
    CLF;ifus;CLCX;01.07.08;-342.545300 ;265491.46;862.6915958;885.735900 ;764'116.92
    CLF;ifus;CLCX;11.08.08;-175.886800 ;170185.92;862.6915958;709.849100 ;612'380.85
    CLF;ifus;CLCX;26.08.08;143.907400 ;-124927.73;863.605235;853.756500 ;737'308.58;
    CLF;ifus;CLCX;28.10.08;-321.308500 ;472031.39;863.605235;532.448000 ;459'824.88;
    CLF;ifus;CLCX;03.11.08;-85.282200 ;73202.14;863.605235;447.165800 ;386'174.73;
    CLF;ifus;CLCX;01.12.08;38.156300 ;-27117.03;851.582394;485.322100 ;413'291.76;
    CLF;ifus;CLCX;02.12.08;168.331000 ;-135004.83;838.8189176;653.653100 ;548'296.59;
    CLF;ifus;CLCX;04.12.08;606.136200 ;-461853.36;801.8403917;1'259.789300 ;1'010'149.95;
    CLF;ifus;CLCX;10.12.08;67.348300 ;-47610.26;797.0237644;1'327.137600 ;1'057'760.21;

    this is how the numbers have to be:
    fund    instr   instr   trade_date       quantity        trade_amount    avg_price     qty_on_hand        total_cost
    code    type    code   
    CLF     ifus     CLCX     01.10.2007      115.2502      -92'411.1831       801.8310       115.2502        92'411.18
    CLF     ifus     CLCX     05.12.2007      318.4801     -336'101.2855       987.9699       433.7303       428'512.47
    CLF     ifus     CLCX     11.01.2008      -64.6781       67'647.0835       987.9699       369.0522       364'612.45
    CLF     ifus     CLCX     25.01.2008       72.5117     -109'197.2543     1'073.0264       441.5639       473'809.71
    CLF     ifus     CLCX     01.02.2008       87.1223     -123'386.8703     1'129.5861       528.6862       597'196.58
    CLF     ifus     CLCX     29.02.2008       110.869      -93'957.7080     1'080.6796       639.5552       691'154.29
    CLF     ifus     CLCX     06.03.2008      -55.2563       49'721.9948     1'080.6796       584.2989       631'439.93
    CLF     ifus     CLCX     12.03.2008      164.4146     -135'834.2457     1'024.7901       748.7135       767'274.17
    CLF     ifus     CLCX     18.03.2008      -37.6276       41'342.6858     1'024.7901       711.0859       728'713.78
    CLF     ifus     CLCX     27.03.2008      159.1288     -112'293.2159       966.4362       870.2147       841'007.00
    CLF     ifus     CLCX     01.05.2008       64.6638      -46'458.2891       949.2841       934.8785       887'465.29
    CLF     ifus     CLCX     23.05.2008      137.3465      -85'979.3210       907.8734     1'072.2250       973'444.61
    CLF     ifus     CLCX     04.06.2008      156.0562      -86'183.2600       862.6916     1'228.2812     1'059'627.87
    CLF     ifus     CLCX     01.07.2008     -342.5453      265'491.4600       862.6916       885.7359       764'116.92
    CLF     ifus     CLCX     11.08.2008     -175.8868      170'185.9200       862.6916       709.8491       612'380.85
    CLF     ifus     CLCX     26.08.2008      143.9074     -124'927.7300       863.6052       853.7565       737'308.58
    CLF     ifus     CLCX     28.10.2008     -321.3085      472'031.3900       863.6052       532.4480       459'824.88
    CLF     ifus     CLCX     03.11.2008      -85.2822       73'202.1400       863.6052       447.1658       386'174.73
    CLF     ifus     CLCX     01.12.2008       38.1563      -27'117.0300       851.5824       485.3221       413'291.76
    CLF     ifus     CLCX     02.12.2008       168.331     -135'004.8300       838.8189       653.6531       548'296.59
    CLF     ifus     CLCX     04.12.2008      606.1362     -461'853.3600       801.8404     1'259.7893     1'010'149.95
    CLF     ifus     CLCX     10.12.2008       67.3483      -47'610.2600       797.0238     1'327.1376     1'057'760.21As you can see on the 3rd line we have a Sell -64.67, thus we take the previous AVG_PRICE.
    Keep in mind that:
    AVG_PRICE = (TOTAL_COST preceding row + TRADE_AMOUNT current row) / QTY_ON_HAND is calculated only on Buy QUANTITY > 0
    TOTAL_COST = QTY_ON_HAND * AVG_PRICE
    this is the output of the query kindly suggested by Alex:
    FUND_CODE INSTRUMENT_TYPE INSTRUMENT_CODE                TRADE_DATE                     QUANTITY         TRADE_AMOUNT          QTY_ON_HAND           TOTAL_COST            AVG_PRICE
    CLF       ifus            CLCX                           01.10.2007 00:00               115.2502        -92411.183116             115.2502        -92411.183116    -801.830999998265
    CLF       ifus            CLCX                           05.12.2007 00:00               318.4801       -336101.285453             433.7303       -428512.468569    -987.969871067343
    CLF       ifus            CLCX                           11.01.2008 00:00               -64.6781         67647.083502             369.0522       -360865.385067    -987.969871067343
    CLF       ifus            CLCX                           25.01.2008 00:00                72.5117       -109197.254334             441.5639       -470062.639401    -1064.54046492705
    CLF       ifus            CLCX                           01.02.2008 00:00                87.1223       -123386.870253             528.6862       -593449.509654     -1122.4985816804
    CLF       ifus            CLCX                           29.02.2008 00:00                110.869        -93957.707954             639.5552       -687407.217608    -1074.82077795318
    CLF       ifus            CLCX                           06.03.2008 00:00               -55.2563         49721.994761             584.2989       -637685.222847    -1074.82077795318
    CLF       ifus            CLCX                           12.03.2008 00:00               164.4146       -135834.245667             748.7135       -773519.468514    -1033.13145617649
    CLF       ifus            CLCX                           18.03.2008 00:00               -37.6276         41342.685831             711.0859       -732176.782683    -1033.13145617649
    CLF       ifus            CLCX                           27.03.2008 00:00               159.1288        -112293.21594             870.2147       -844469.998623    -970.415690085447
    CLF       ifus            CLCX                           01.05.2008 00:00                64.6638        -46458.289084             934.8785       -890928.287707      -952.9883163502
    CLF       ifus            CLCX                           23.05.2008 00:00               137.3465         -85979.32104             1072.225       -976907.608747    -911.103181465644
    CLF       ifus            CLCX                           04.06.2008 00:00               156.0562            -86183.26            1228.2812      -1063090.868747    -865.510982946739
    CLF       ifus            CLCX                           01.07.2008 00:00              -342.5453            265491.46             885.7359       -797599.408747    -865.510982946739
    CLF       ifus            CLCX                           11.08.2008 00:00              -175.8868            170185.92             709.8491       -627413.488747    -900.493486542659
    CLF       ifus            CLCX                           26.08.2008 00:00               143.9074           -124927.73             853.7565       -752341.218747    -881.212873632002
    CLF       ifus            CLCX                           28.10.2008 00:00              -321.3085            472031.39              532.448       -280309.828747    -881.212873632002
    CLF       ifus            CLCX                           03.11.2008 00:00               -85.2822             73202.14             447.1658       -207107.688747    -526.454843941568
    CLF       ifus            CLCX                           01.12.2008 00:00                38.1563            -27117.03             485.3221       -234224.718747    -482.617047002393
    CLF       ifus            CLCX                           02.12.2008 00:00                168.331           -135004.83             653.6531       -369229.548747    -564.870798818211
    CLF       ifus            CLCX                           04.12.2008 00:00               606.1362           -461853.36            1259.7893       -831082.908747    -659.699926604393
    CLF       ifus            CLCX                           10.12.2008 00:00                67.3483            -47610.26            1327.1376       -878693.168747    -662.096506607152 As I said I'll try to elaborate on the idea of Alex, does not mean that I don't need any other help.
    ON THE CONTRARY !
    Any help is more than welcome.
    Sorry again if I am not clear in my posting, this is my first time, have patience please.
    thanks again
    Claudio

  • How tom take an average of file when i have three different values

    Dear all,
    I have a file with five column,                                                              
    A    B                      C    D    E               
    2    1.23375E+17    30    31    2              
    2    2.04196E+17    0      32    2               
    2    2.31994E+17    0      33    2               
    2    2.01626E+17    30    33    2       
    2    1.79445E+17    0      34    2          
    I want to take an average of  B for D= 0 to 15,,, 16 to 30, ,, 31 to 45, 46 to 59,, anf E= 0 ,2,3,4,5,........ 23,
    for A = 2, 3, 4, 5, ......32..
    here is programme and file.
    Solved!
    Go to Solution.
    Attachments:
    iisc0040-1014.txt ‏1489 KB
    average15mins.vi ‏11 KB

    I aapreciate with you sir,
     acually my problem is differenet, i repeat it belowe.
    A    B                      C    D    E               
    2    1.23375E+17    30    0    0              
    2    2.04196E+17    0      1    0              
    2    2.31994E+17    0      2    0              
    2    2.01626E+17    30    3    0      
    2    1.79445E+17    0      4    0        
    1-Column A having the value of no of system which start from 2 to 32,,
    2- colum D having the minutes which is start from 0 to 59.
    3- colum E is hour Which varies from 0 to 23.
    now i want to keep system (Column A) constant at 2 and for 0 hour ( Column E).. and want to take the average of Values (Column B). For 0 to 15 , 16to 30 , 31 to 45, 46 to 59 ,,,minute (column C).
    Means I will have 4 value for each hour,
    means i want to put first lup where Column A is constant for 2, at the same time second lup inside the first lup Having the constant value of Column 2.  and at third lup  take the avergae of value B for each 0 to 15, 16 to 30, 31 to 45, 46 to 59,..
    hope you will help me regarding this,

  • How to get the filename in mapping when using sender File adapter?

    hi Experts,
       I have scenario where XI reads the input file using Sender file adapter.
       The file name is configured in the communication channel.
       In my message mapping it is possible to read this file name?
    Thanks
    gopal

    Hi Gpoal,
    Use Dynamic Configuration - /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards,
    Geetha

Maybe you are looking for

  • Partner profile is not workin for automatic vendor posting

    Dear SAP Gurus, When i am doin the intercompany billing so the RD04 output calls but the status is red and when i see the processing log the system says that EDI: Partner profile not available..and also vendor A/P dont generate..even though i have ma

  • Adobe Forms Date Format DD.MM.YYYY.

    Hi Experts, I am new to Adobe Forms(Transaction SFP) . The Client has requirement to display the data in DD.MM.YYYY format. I saw that the standard 'Date fields' in ADOBE forms does not have this format. Any Ideas. Thanks.

  • Problem with End button

    Hi, We are facing a problem with the "End" button of IC Webclient(CRM 4.0). After confirming the contact, when we tried to end the contact using End button. It is not working. Please help us as it is very urgent. Thnks YWa

  • Denmark NTSC or PAL

    I am kinda in a hurry to send a DVD off to Denmark for a family reunion. I completely forgot about the format. It is a slide show I did in NTSC. PAL or NTSC is the question or both maybe. I apologize for my ignorance! Rob

  • Android AIR Runtime Not Bundled?

    Hello, I am using Flash Builder to build my app for Android. I have selected the option to bundle the AIR runtime with the application. When I debug the application on the Android device, it still prompts me to download the AIR runtime. Why is it not