Problem with moving average

I have to create a report which displays rolling average of revenue.
The report contains two columns week and avg revenue. I have to display only ten weeks from the current week.
For each week the revenue should be calculated as follows;
weeks     actual revenue     Avg revenue
1     10          10     
2     20          (10+20)/2
3     30          (10+20+30)/3     
4     40          (10+20+30+40)/4
5     50          (20+30+40+50)/4
6     60          (30+40+50+60)/4
(current week-10 weeks)
current week
I have used Mavg(actual revenue, 4) to calculate avg revenue.
I am getting the correct values. However if I apply a filter say weeks between current week and (current week-10 weeks), I am facing a problem.
My (current week-10 weeks) is now showing avg revenue as 10 which is my actual revenue amount.
But i would like to show the revnue amount as an avgerage of (current week-10 weeks) and previous three weeks.
The filter to limit the number of weeks is applied before calculating the moving average. Is there anyway to calculate the moving average first and then apply the week filter to report.
Pls help me solving this.
Thanks

Do this:
Have the measure as :
case when Periods."Weekdate" > TIMESTAMPADD(SQL_TSI_WEEK, -10 , CURRENT_DATE) then MAVG ("Sales Measures".Units, 4) else 999999999 end
And then apply filter on the above measure column as :
Case when Periods.Weekdate > TIMESTAM... ' is not equal to / is not in 999999999
Let us know how it goes.
PS : To prevent runaway query, you may want filter it further by Periods."Weekdate" > TIMESTAMPADD(SQL_TSI_WEEK, -15 , CURRENT_DATE)

Similar Messages

  • PROBLEM WITH MOVING AVERAGE PRICE

    Hi,
    Correct me if I’m wrong, but from what I know the moving average price should only change or be recalculated when purchases or goods_recipts are made, otherwise items should be consumed at a FIXED moving average price (cost). 
    I´ve noticed when looking into the Inventory Audit Report that the moving average price is changing in my installations and I see that SAP BO recalculates it every time an issue is made. This last thing only happens when the total amount of the transaction is rounded or left with 0 decimals and the other types such as prices, rates, quantities, percent, etc. are left with 2 or 3 decimals.
    Because of my country settings, the total amount has to have 0 decimals (I live in Chile and we don’t have cents in our currency) and the moving average price of an Item should not change when an issue is made, can you help me with this?
    Thanks and best regards to you all.
    Fernando

    Hi Nagesh,
    Thank you for your quick response.
    I understand what you say, but moving average price should not change when an issue is made and that´s what is bothering us.
    The difference between what it shoud be and what SAP BO is calculating is our concern, ie: let´s say the number of transactions is 100, would that difference be negligible?
    Here is an example:
    Goods issue:
    SO 8     11     -10,49     166,67     -1.748     99,35     16.559
    SO 9     11     -10,49     166,673     -1.748     88,86     14.811
    SO 10     11     -10,49     166,678     -1.748     78,37     13.063
    SO 11     11     -10,48     166,684     -1.747     67,89     11.316
    SO 12     11     -10,56     166,681     -1.760     57,33     9.556
    Note that coma (,) is decimal separation and period (.) is the mile separator.
    Where the 3rd line is the quantity of the goods issue, the 4th is the moving average, and the 5th is the total quantity of the issue.
    So you see 10,49 x 1748 = 1748,39977= 1748(SAP) and then SAP BO recalculates the AVG. Price.
    The problem I was talking about was the difference of the stock AVG Price with one hundred transactions or so... now the difference seems negligible (166,7 - 166,681 = 0,011).
    Can you see it changes?, is that a bug?
    Thank you
    Fernando

  • With Moving Average Price"V" ,in import Process

    Hi
    All
    With Moving Average Price"V" , I want to post the Exchange Rate Difference Between GRN And MIRO to seperate G/L Acc. not for Stock Acc. in Import Process.
    Presently it is posting to Stock Acc.
    Can any one tell me
    Regards
    Manju

    Hi
    In SPRO - SAP IMG- Material Management - Logistics invoice verification - Income invoice- Activate direct posting to G/L accounts and Material accounts
    Then do the MIRO
    And try it out.
    REgards,
    Raman

  • STO with moving average price & with out moving average price

    Hi,
    i have two questions.
    1) I have created STO and issued the material with 351 movement type, after issuing material accounting documents will be with moving average price from issuing plant.
    what is the other process to issue with out moving average price ,the price must take as per in PO(sto).
    2) why we will use STO why cont we use 301 movement type with one step transfer.
    Pls help
    Regards
    Sunil

    Hi Sunil,
    1) the 351 movement type uses always the price from the material master, you can't change it
    2) I don't really understand your question. You need advise when using STO and when 301?
    Attila

  • MTS variances with moving average price

    Hi expert,
    Is it possible to satisfy this requirement for cost estimate and variances in make to stock scenario ?
    -Actual cost at Moving average price for all article
    -Calculate cost estimate for articles and write it on standard price field with strategy that read also standard price
    -Calculate planning and production variances for all the Make to Stock PP order?but stock must be update with Moving average price.
    My doubt is how can i have variances detailed if i manage article with Moving average price.
    How can I have variances as "statistics" otherwise I would have double costs.
    thanks

    HI
    If you manufacture some thing, its price control should never be V, else it ruins the inventory valuation forever
    Consider the eg below if your price control is V
    1. Your moving price in mat master is 100 USD
    2. You Mfr on Jan 1 @ Actual cost = 110 in Prod order and Qty = 1.
    Upon GR, GR will happen @ 100 and at period end if Qty is lying in stock, 10 variance will also be inventorized
    BUT, now consider this
    1. Your moving price in mat master is 100 USD
    2. You Mfr on Jan 1 @ Actual cost = 110 in Prod order and Qty = 1.
    Upon GR, GR will happen @ 100 and variance lying is 10 in prod order
    3. You Mfr on Jan 10 @ Actual cost = 110 in Prod order and Qty = 1.
    Upon GR, GR will happen @ 100 and variance lying is 10 in prod order
    4. On jan 15, you consume Qty 1 and qty lying in stock is 1
    5. In period end, when you do settlement, following will happen
    a. For prod order 1: Qty Mfd 1 and Qty lying in stock 1 - Result: variance 10 will be inventorized.
    Mvg Avg price will shoot upto 110
    b. For prod order 2: Qty Mfd 1 and Qty lying in stock 1 - Result: variance 10 will be inventorized.
    Mvg Avg price (MAP) will shoot upto 120
    System wont check whether the qty lying in stock pertains to prod order 1 or 2... It will simply check if the Qty of prod order matches with qty lying in stock. hence, it will keep on inventorizing variance in this case.... and your MAP will touch the sky
    Regards
    Ajay M

  • Problems with moving directories

    Hi, i have a problem with moving one subdirectory from one directory to another. Here is the code
         public static boolean moveToDir(String filename, String dirname)
         if( XFileUtils.fileExists(filename) )
         return onMoveSingleFileToDir(filename,dirname);
         File dir = new File(".");
         FileFilter fileFilter = new WildcardFilter(filename);
         File[] files = dir.listFiles(fileFilter);
         boolean _flag = true;
         for (int i = 0; i < files.length; _i++)
         String _cfilename = files[_i].getName();
         if( !XFileUtils.fileExists(_cfilename) )
         throw new RuntimeException("file or dir does not exists"+_cfilename);
    flag = flag && onMoveSingleFileToDir(_cfilename, dirname);
         return _flag;
    Can anyone help me?
    Thank you very much!
    Elias

    Also, a sample DAD would look like:
    <Location /database1>
    SetHandler pls_handler
    Order allow,deny
    Allow from All
    AllowOverride None
    PlsqlDatabaseUsername APEX_PUBLIC_USER
    PlsqlDatabasePassword This_Password
    PlsqlDatabaseConnectString database1 TNSFormat
    PlsqlDocumentTablename wwv_flow_file_objects$
    PlsqlDocumentPath docs
    PlsqlDocumentProcedure wwv_flow_file_mgr.process_download
    PlsqlDefaultPage f?p=130
    </Location>
    <Location /database2>
    SetHandler pls_handler
    Order allow,deny
    Allow from All
    AllowOverride None
    PlsqlDatabaseUsername APEX_PUBLIC_USER
    PlsqlDatabasePassword This_Password
    PlsqlDatabaseConnectString database2 TNSFormat
    PlsqlDocumentTablename wwv_flow_file_objects$
    PlsqlDocumentPath docs
    PlsqlDocumentProcedure wwv_flow_file_mgr.process_download
    PlsqlDefaultPage f?p=131
    </Location>
    The tnsnames.ora file would then look similar to:
    DATABASE1 =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = the_database_server)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = DATABASE1)
    DATABASE2 =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = the_database_server)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = DATABASE2)
    Again, these are edited copies of what I use, but something similar should work for you.
    Bill Ferguson

  • How to distribute exchange rate difference to material with moving average price?

    Hi community,
    Exchange rate differences are not distributed into the items based on the shipment (per article/material). Is there a workaround available based on the GR/IR exchange rate difference and the material that was purchased?
    Thank you and best regards,
    Barbara Dörr

    Hi Lokesh,
    thanks a lot for the quick answer, but I
    had read this documentation and only found this documentation of exchange rate
    difference posting:
    GR/IR clearing uses the exchange rate of
    the goods receipt. The GR/IR clearing run completely clears Unbilled Payables
    and Purchases in Transit. The run calculates price differences of EUR 155 and exchange rate differences of EUR
    135. The price differences are posted to the price difference account and the
    exchange rate differences to the exchange rate difference account.
    Therefore I guessed that the exchange
    rate differences are NOT distributed to the material with moving average price.
    Best Regards,
    Barbara

  • GL to get updated with Moving average price

    Hi Guru's
    when we do PGI, currently the cost of goods issue value is updated from Moving average price into a GL account,
    Now i have created a new GL account and also want this new GL to get updated with the Moving average Price.
    Where can i make these settings. can u give step by step solution.
    Regards
    Abhijeet

    First u pls check how its updating with moving average price and select in MMRecord valuation class and price options, then check settings for ur gl account go to fs00 display mode check settings in control data.
    Compare ur gl account which u have created with standard Gl account.

  • FIFO with moving average price

    we are using for own produced goods "moving average price" and Material ledger. At month end we setlle production variance . The system also creates an entry for ML "price variance" (which is the percentage of the prodcution variance for the remained stock).
    When we run the document extract (MRF3), with the option of "Order settlement", the costs include not only the production variance but also the ML line. That is too high.
    When we run it without selecting "Order settlement" the adjustement is the reversal of the price variance (the ML line item). That is too low.
    The total costs should be only the total production costs.
    One cannot exlude it by the material movement as both "price variance" and "production variance" is not part of a material movement.
    Edited by: Hendrik585 on May 27, 2011 2:16 PM
    Edited by: Hendrik585 on Jun 5, 2011 11:36 PM

    hi,
    We need to follow the steps if we need to valuate our inventory by means of FIFO Scenario :
    1. In T-code OMWE, activate the balance sheet valuation as LIFO Valuation not active & FIFO Valuation active.
    2. In T-code MRLH, FIFO Maintained at company code or plant level.
    3. In T-code OMWL, set mean receipt price at valuation ares level if Plant or at company code level if at company code level.
    4. Configure FIFO Valuation ares for teh respective year.
    5. In T-code OMWP, Configure FIFO Method.
    6. In T-code OMW4, Movemnet type settings for FIFO maintained. Generally, no chnages made.
    7. Select material for FIFO in Tcode MRF4.
    8. Execute FIFO Valuation- Tcode MRF1.
    Hope it helps..
    Regards
    Priyanka.P

  • SAP allows release of Standard Cost for Material with Moving Average Price

    Hi
    We set our Raw Material to use Moving Average Price (V) and price determination 2 (single level). And we activated material ledger.
    During mass calculation of standard cost (CK40N), If user accidentally forgot to restrict the Raw Material for being included in calculation, the system calculate standard cost anyway, even though I set it as Moving Average Price. And user is able to release it too without any problem.
    Why the system does not restrict it? By giving error maybe. Although as for now I can not find the wrong effect from releasing standard cost for MAP material, by your experience, is there any side effect that I should be aware of?
    Thanks

    CK40n is mass release of all materials. The release is not dependent on price indicator of the material in the master. It will calculate standard cost of all the materials.
    Releasing standard cost estimate of raw materials does not have any side effect as long your calculation is based on moving average price.
    Regards
    Divraj

  • Batch Management with Moving Average Price

    Hi all,
    I got a question here. If we use batch management in SAP with our price control as 'V' (MAP for Moving Average Price), and we do good issue out by batch, will the system credit my stock based on MAP value or the actual value (actual PO price by batch)

    Any kind soul can helps me??

  • How to enter initial balance for material with moving average price

    We have an issue where the customer wants to split one material into three materials. We are thinking of posting goods issue for the original material and post goods receipt for the new three materials. But how to enter the initial balance since these three materials must have moving average price.

    Hi,
    If you create material first time in system with the help of MM01 then specify the price this will gets affect on moving price.
    and if the material is created with ZERO price then use the option MR21 which is said by  Jürgen
    Reagrds
    Sandesh

  • Material with moving average price ,while posting grn act as standard price

    hi gurus
    i have a material with a moving average price , according to moving average price during grn posting no price difference account should be created at any circumstance , but while i posted grn , i am getting stock account - wip 14407.98 , GRIR - DM 16800 -
    Price difference  matl trns - 2392.02 WHY THESE PRICE DIFFERENCE CREATED  i have maintained only moving average price in  accounting view
    regards
    Leo

    hi
    In SAP we have two price control  moving average price and standard price
    In MMR if u using Moving average Price  if any difference in price it will post it to stock account
    but in case of standard price it post it o PRD account (Price diff Account)
    Regards
    AKM

  • Materials with moving average price that have goods receipt without PO

    We want to have materials on moving average price, but they are not purchased but are leftovers from production process that can be used again. As such we want to put them in inventory according to internally determined price but to use V price control in order to avoid reavluation of existing inventory when price changes. How this can be done as we don't have PO where to put the price. Maybe is possible to have dummy PO without vendor?

    Hi there,
    so there is never a "regular" GR or invoice? And the material will be put back to stock using movement Type 262, for example?
    There is a way... Consider to activate the "External GA Amount" for the relevant movement type(s). You can do this by customizing the movement type's field selection, category "Materials management". Set this field to "optional". After this you can enter a value in the detail dynpro of the movement. Watch out, it is the value for the posted quantity, not a price... The valution price will be recalculated, the moving everage price will change, but there is no revaluation.
    Does this help?
    Kind regards from Germany,
    Bernd

  • Inventory list with moving average price

    Hi all,
                 How do I get the list of inventory stock using the valuation method as MOVING AVERAGE.
    Iam able to get the list using last purchase price, But how do I get it using Moving average Price.
    Thanks in advance.

    Moving average price for item might be different by each warehouse.  Inventory Valuation Report can be used to get the whole picture for any single item by moving average price.
    If you want to get more items, you can try this query to see:
    SELECT T0.ItemCode, T1.ItemName, T0.WhsCode, T0.OnHand, T0.AvgPrice, (T0.OnHand * T0.AvgPrice) AS 'Amount'
    FROM dbo.OITW T0 INNER JOIN dbo.OITM T1 ON T0.ItemCode = T1.ItemCode WHERE T0.OnHand > 0
    Thanks,
    Gordo

Maybe you are looking for

  • Change Request Management in Sharepoint

    Hi - I've read through pages and pages of online content on ticketing/support systems etc. and somehow still can't seem to find something that best matches what I want to achieve - So hoping someone can help... I work in an IT Development office, and

  • Iphone not recognized by pc or itunes

    i have two iphone 4s phone, one is recognized by the pc and itunes and one is not.  they both have the same software update.  is there something on the phone that is not set right?  i've searched everthing and coming up empty. help.

  • NI PXI-7340: Motor cannot rotate counterclockwise

    HI, I am a new user in Labview. I am trying to control a DC brushed motor using NI motion card PXI-7340 and UMI-7774. I am connecting the NI system to an arduino mega to turn the +-5V control signal into PWM signals (analogread and PWM out), before s

  • Problems install Elements 11

    When trying to install Elements 11 when the registration window appears and I enter my Adobe Password a popup appears as says "you must enter 6-12 characters with no spaces or colons" and will not let me proceed with the install.  Can anyone help?  I

  • CTE'S in Oracle

    I am a new developer on Oracle 10g...Can i use CTES(common table expressions) in PL/SQl as in SQl.... If yes a brief example can help me...thank you What i am basically ttring to do is slect some fields from group of tables and use those fields in a