Determining simple moving average based upon duration

Here is the link to the image of the spreadsheet that I am developing: http://dl.dropbox.com/u/13788011/Spreadsheet%20Image%2001.jpg
This spreadsheet will allow me to track my ongoing progress on my favorite disc golf course. Column F (30 Day SMA*) is the column that needs a formula that I can't figure out how to write.
What I want to do:
I want each cell in column F to show the average score (derived from column B) for all dates played between that date (column A, same row as the F-cell) and any score from within the previous 30 days.
I have been reading various materials so far, but none of these sources address this particular desire of mine, and -- as that I am still learning Numbers '09 -- this formula is too convoluted for me to figure out. Any help would be greatly appreciated.
Thanks,
Kris
PS - I know of the moving average feature available in Numbers' charts, but I am desiring an actual number within the table.
*SMA = Simple Moving Average

kris,
Thank you for the star. Glad to hear that the solution worked for you.
Yes, the formulas are nice and compact in Numbers when you use the column and row shortcuts.
All the ...IFS formulas are pretty powerful for setting conditions. The learning threshold is placing those darn quotes and ampersands in the right places for the comparison operators.
Good luck,
Jerry

Similar Messages

  • Custom Unattended Process Model Based Upon Duration of Test

    I am looking to develop a test system that:
    Runs the Batch Process Model
    Displays a Custom UUT Serial Number dialog once upon start
    This dialog will also display the desired test duration and various instrument settings
    Loops on the MainSequence for a fixed amount of time OR Loops on the main sequence for a fixed number of iterations
    This should be implemented in the process model
    Does not display any pop-up dialogs during testing
    The goal is for the test to run "unattended"
    I started with a copy of the Test UUTs process model, but wanted to get some advice on how others would design this system.
    A few questions:
    What is the best method for implementing the looping on the MainSequence for a fixed amount of time in the process model?
    What is the best method for avoiding pop-up dialogs from occurring during the test?
    Thanks!
    CLA, CTA

    Put the call to MainSequence inside of a While loop. Use Seconds() to get current time, store in variable and then measure difference between subsequent calls to Seconds() and that variable to determine if your timeout has been met. You can also increment a counter in this loop as well.
    Use custom PreUUT, PostUUT, ProcessModelPostStepRunTimeError and ProcessModelPostStepFailure callbacks. All TestStand-based popups occur in those four areas. There are examples of handling run time errors and failures in the TestStand example folder.
    CTA, CLA, MTFBWY

  • Simple moving average block diagram

    I am reading https://decibel.ni.com/content/docs/DOC-5041
    and since I only have access to LabVIEW 6.1, I am interested in the block diagram JPG.
    Unfortunately, I am getting an error when I click on the JPG.
    Can someone help me out by posting it?
    Solved!
    Go to Solution.

    This seems like very clumsy code. For example if you later want to average more or fewer elements, you would basically need to rewrite the code from scratch. It is not scalable! Why would you need six diagam constants (DBL zero)? All you need is one and branch the wire. Why would you wire N of the FOR loop when autoindexing over the array? This is very crude beginner code that will only teach you bad habits.
    If you don't have access to the "ptbypt mean", you can make your own. Here is an old example (see lower part of code. The ptbypt version above it is just used to show that it gives the same result)
    Try to implement it. To change the number of points to average, all you need to do is change a single integer. Since the mean does not care about the order of elements in the buffer, all you need is replace the oldest with the newest at each iteration, no need for rotating or shifting, etc.
    LabVIEW Champion . Do more with less code and in less time .

  • Exponential Moving Average - EMA - in PowerPivot

    Hello All
    We´re having a challenge trying to put the [20] (trading days) Exponential Moving Average (EMA) in our data model in PowerPivot.
    Here is the EMA formula and sample spreadsheet:
    http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages
    Pasted the formula here for convenience:
    SMA (simple moving average): [10] period sum / [10]
    Multiplier: 2 / ([Time period] + 1) )
    EMA: {Close - EMA(previous day)} x multiplier + EMA(previous day).
    Sample spreadsheet
    http://stockcharts.com/school/data/media/chart_school/technical_indicators_and_overlays/moving_averages/cs-movavg.xls
    In our model the fact table have these columns:
    Symbol Date Open High Low Close Volume
    And in the Calendar table we´ve identified the trading days (Calendar[TradingDayNumber]) as 1 so we can count them back.
    We want the EMA calculated field in a pivot table like this
    Filter context: a date selected on Calendar[FullDate]
    Row context: FactTable[Symbol]
    Values: FactTable[Close]
        FactTable[EMA 20D] >> Missing
    So far we got these calculated fields:
    Period
    =20
    Ema Multiplier
    =2 / ([Period] + 1)
    Average 20D CLOSE
    =IF([Sum of CLOSE]=BLANK(),BLANK(),(CALCULATE(AVERAGE(FactTable[CLOSE]),FILTER(ALL(Calendar),Calendar[TradingDayNumber]<=MAX(Calendar[TradingDayNumber]) && Calendar[TradingDayNumber]>MAX(Calendar[TradingDayNumber])-[Period]))))
    But it looks like the EMA formula contains a self reference from previous values, and it also starts from a SMA (Average 20D CLOSE) value.
    How can we do it?
    Thanks in advance. I highly appreciate your support.

    Nico,
    Is this still an issue?
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Help in Moving Average Query

    Hello,
    I would like to have a query for finding moving average. based on some conditions.
    I have written query as follows:
    SELECT Column1,
    MONTH_END_DATE,
    (AVG(sum(Col2 *(case when (Col3 ='XYZ') then 1 else 0 end)))OVER (PARTITION BY Column1 ORDER BY MONTH_END_DATE ROWS 5 PRECEDING)) AS AVG_XYZ,
    sum(Col2 *(case when (Col3 ='XYZ') then 1 else 0 end)) as Cumm_XYZ
    FROM
    Table_cd
    WHERE
    Column1 ='1234567'
    GROUP BY Column1, MONTH_END_DATE.
    My problem is if there are no data in a month, then the average calculated will vary from the required.
    For Eg., If i have to find the average of months between JULY and DECEMBER and if the table doesnt have data in the month of OCTOBER, NOVEMBER then while finding the average it will consider only 4 Months instead of 6 Months..So is it possible to write query such that if there are no data in a month then consider the values for that month as zero and then find the average..
    If anybody can help me in this regard, it will be very useful

    Mr.BluShadow if u can just show me how i can find
    average for the values returned by the example
    written by you, it would be very helpful..Obviously the hint wasn't enough... here's another...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('01/07/2007','DD/MM/YYYY') as dt, 1 as val from dual union all
      2             select to_date('02/07/2007','DD/MM/YYYY'), 2 from dual union all
      3             select to_date('03/07/2007','DD/MM/YYYY'), 3 from dual union all
      4             select to_date('04/07/2007','DD/MM/YYYY'), 4 from dual union all
      5             select to_date('01/08/2007','DD/MM/YYYY'), 5 from dual union all
      6             select to_date('02/08/2007','DD/MM/YYYY'), 6 from dual union all
      7             select to_date('03/08/2007','DD/MM/YYYY'), 7 from dual union all
      8             select to_date('01/09/2007','DD/MM/YYYY'), 8 from dual union all
      9             select to_date('02/09/2007','DD/MM/YYYY'), 9 from dual union all
    10             select to_date('03/09/2007','DD/MM/YYYY'), 10 from dual union all
    11             select to_date('01/12/2007','DD/MM/YYYY'), 11 from dual union all
    12             select to_date('02/12/2007','DD/MM/YYYY'), 12 from dual union all
    13             select to_date('03/12/2007','DD/MM/YYYY'), 13 from dual union all
    14             select to_date('04/12/2007','DD/MM/YYYY'), 14 from dual
    15            )
    16  --
    17  select m.dt, AVG(NVL(t.val,0)) as val
    18  from t, (select add_months(to_date('01/07/2007', 'DD/MM/YYYY'),rownum-1) as dt from dual connect by rownum <= 6) m
    19  where m.dt = trunc(t.dt(+),'MM')
    20  group by m.dt
    21* order by dt
    SQL> /
    DT               VAL
    01-JUL-07        2.5
    01-AUG-07          6
    01-SEP-07          9
    01-OCT-07          0
    01-NOV-07          0
    01-DEC-07       12.5
    6 rows selected.
    SQL>

  • Moving Average does not base on Posting Date??

    Hi All,
    I got the problem with moving average, seem that the Posting Date is ignored when posting Sales document or purchase document,and moving average does not calculated correctly.
    The system only calculated the moving average
    based on the input seq, and the posting
    date is ignored??
    does anyone know its normal? or any
    setting can change the behavior?
    or any system auto adj?
    thanks
    Chris

    Hi Chris,
    This is standard functionality of SAP Business One.
    Please consider that system works with Continuous Stock System option enabled. This causes, that each item receipt have direct impact on MAP.
    Of course you have possibility to turn this off (before first posting), however then you will not have postings to the stock account, but to the revenues and expenses. In this case also MAP is not handled by the system.
    regards,
    Maciek

  • Moving average forecast does not work correctly

    Hello,
    I have a forecast model with the strategy moving average 6 months. When I checked the forecast values in the planning book, I recognized that there is a mismatch with the calculation of the forecast:
    There is a drift of 2 months when showing the values in the appendant buckets. The first bucket which is filled with forecast values (bucket: current month + 1) contains the moving average value from month - 8 until month - 2.
    Example: forecast value for Feb 12 is calculated as follows:
    (Nov 11 + Oct 11 + Sep 11 + Aug 11 + Jul 11 + Jun 11) / 6
    It is the same procedure for all other following months.
    The right calculation should be as follows:
    (Jan 12 + Dez 11 + Nov 11 + Oct 11 + Sep 11 + Aug 11) / 6
    I checked several settings in the activity and job creation and in the setting of the forecast profiles. I expected that an offset of 2 months is set, but there is nothing.
    So, I do not know how to explain this system behaviour....
    Hope anybody can help!
    Thanks and kind regards
    Heinz

    Hello Heinz,
    The only place to check is the forecast profile. Let me assume that you are not talking with reference to SPP. Also, that the period indicator in your master profile is Months. So, this would mean that you have maintained forecast profile as follows:
    You need to cross-check that the offset in the section history horizon of the master profile should have value +1, since you are running the forecasting during January, and you want January history to be considered in average calculation. Periods in history horizon should be 6.
    Similarly, in the forecast horizon in the master profile, you should have an offset of +1, since you are running the forecast in Jan, but you want the forecast to happen from the month of Feb onwards.
    Also, check in the univariate profile tab that you are checking for the right KF for history values, when you look in the planning view. 
    There is nothing more to standard forecasting apart from few things like 'like profile' or 'phase-in, phase-out' profile. Other option for changes is some custom logic, but it doesn't seem that there is a need for it if calculation is for simple moving average.
    So, if the above points don't explain your situation, then better to raise OSS for SAP, to see if there could be some bug.
    Thanks - Pawan

  • Moving average price based on valuation type for material

    Gurus help needed.
    we want to maintain the moving average price of the material in the pricing, and this depends on the Valuation Type. We have 3 valuation types.
    If valuation type is blank then one MAP(Moving average price) value will come and if nn one map will come and for nn one map will come.
    We have copied VPRS conditon type to YVRP and changed conditon category as T( Moving cost).
    But in pricing the YVRP price is not picking from valuation type which is blank.
    Where can  i make the settings to tell the system to pick the moving average price from the material master where the valution type is blank always based on the condition.
    Do we need to creat a routine? If so is there any standard routine which we can use or make minor changes to it?
    If it is a new routine please tell me how to start with VOFM?
    Note : We need the value to come automatically from material master same as VPRS.

    Hi
    The first method is not to set the pricing condition VPRS as statistical.
    Simply remove PR00 and it will work fine if you always use VPRS as your pricing base inside the pricing procedure.
    VPRS will reads both prices based on the price control in the material master. 
    Price control S for standard price. 
    Price control T for moving average price. 
    It is this simple if you do not have any other "Prices" in the price procedure. 
    However, if you are using one pricing procedure where for some items you price using VPRS and some others using PR00, then you should use requirement routines to enable the correct price condition type at the right time. 
    The second method involves more work as you need to write a formula (VOFM) to get that information. 
    This is how it goes :- 
    1. Set VPRS to be the first step in the pricing procedure and to be subtotal B (as standard). 
    2. Set PR00 with alt. calc. type formula, which sets the value of PR00 to be equal to the subtotal B.
    Step 1 VPRS statistical, subtotal B, reqt 4 
    Step 2 PR00 Altcty 600 
    With regards
    baalakrushnan.da

  • Goods Receipt Amount based on PO price instead of moveing average price

    Is it possible to customise SAP so that the amount in Goods Receipt transactions is calculated based on quantity * PO price instead of quantity * moving average price?
    Thanks.

    Thanks for your reply.
    Standard SAP functionality:
    1. When material ledger is active, the GR amount is based on pre-GR moving average price.
    2. When material ledger is not active, the GR amount is based on PO price.
    We use the material ledger but want the GR transactions to record the amount based on PO price.
    Any suggestions?

  • Moving average price calculation based on year to date figures

    Hello,
    I've been working for months on the stock valuation at month end closing for the Finance department. We discover a situation where the moving average price is not calculated as we expected.
    The situation is as follows:
    2 purchase orders for the same material at different periods and with different purchase order prices
    the invoice of the first pruchase order has been recorded after the good receipts of the 2 purchase orders with purchase price variance, good issues have been recorded between the good receipts and the first invoice receipt, therefore the stock quantity is lower than the quantity invoiced
    the invoice of the second purchase order has been recorded as well with price purchase variance after the first invoice and after good issues, therefore the stock quantity is lower than the quantity invoiced.
    Here is an example with figures:
    SAP Calulation
    Good entry
    Good Issue
    Before Posting
    After Posting
    Good receipt
    Invoice receipt
    Date
    Movement
    Quantité
    Price
    Value
    Quantité
    Price
    Value
    Quantité
    Value
    PMP
    Quantité
    PMP
    Value
    Quantité
    PMP
    Value
    01.01.2014
    Intial Stock
    2000
    11
    22000
    16.01.2014
    Purchase Order 1
    10000
    10
    100000
    2000
    11
    22000
    12000
    10,17
    122040
    20.01.2014
    Good issue
    2000
    20340
    10,17
    12000
    10,17
    122040
    10000
    10,17
    101700
    18.02.2014
    Purchase Order 2
    20000
    9
    180000
    10000
    10,17
    101700
    30000
    9,39
    281700
    22.02.2014
    Good issue
    22000
    9,39
    206580
    30000
    9,39
    281700
    8000
    9,39
    75120
    30.03.2014
    Purchase Order 1
    10000
    9,5
    95000
    8000
    9,39
    75120
    8000
    8,89
    71120
    21.04.2014
    Good issue
    2000
    8,89
    17780
    8000
    8,89
    71120
    6000
    8,89
    53340
    31.05.2014
    Purchase Order 2
    20000
    7
    140000
    6000
    8,89
    53340
    6000
    6,89
    41340
    - When the first invoice is recorded, SAP calculate the MAP this way: ( 8000*9,39 + (95000-100000) * (8000/10000) ) / 8000 = 8,89
    - When the second inoice is recorded, SAP calculate the MAP this way: ( 6000*8,89 + (140000-180000) * (6000/20000) ) / 6000 = 6,89
    Moving average price calculation requirement
    Good entry
    Good Issue
    Before Posting
    After Posting
    Good receipt
    Invoice receipt
    Date
    Movement
    Quantité
    Price
    Value
    Quantité
    Price
    Value
    Quantité
    Value
    PMP
    Quantité
    PMP
    Value
    Quantité
    PMP
    Value
    01.01.2014
    Intial Stock
    2000
    11
    22000
    16.01.2014
    Purchase Order 1
    10000
    10
    100000
    2000
    11
    22000
    12000
    10,17
    122040
    20.01.2014
    Good issue
    2000
    20340
    10,17
    12000
    10,17
    122040
    10000
    10,17
    101700
    18.02.2014
    Purchase Order 2
    20000
    9
    180000
    10000
    10,17
    101700
    30000
    9,44
    283200
    22.02.2014
    Good issue
    22000
    9,44
    207680
    30000
    9,44
    283200
    8000
    9,44
    75520
    30.03.2014
    Purchase Order 1
    10000
    9,5
    95000
    8000
    9,44
    75520
    8000
    9,28
    74240
    21.04.2014
    Good issue
    2000
    9,28
    18560
    8000
    9,28
    74240
    6000
    9,28
    55680
    31.05.2014
    Purchase Order 2
    20000
    7
    140000
    6000
    9,28
    55680
    6000
    8,03
    48180
    - When the first invoice is recorded, SAP should calculate the MAP this way: (2000*11+10000*9,5+20000*9)/(2000+10000+20000) = 9,28
    - When the second inoice is recorded, SAP should calculate the MAP this way: (2000*11+10000*9,5+20000*7)/(2000+10000+20000) = 8,03
    Could you tell me if you know how to set up the calculation based on this formula (Intial stock value at MAP + Year to date Purchasing value) divided by (intial stock quantity + quantity purchased)?
    Thank you in advance
    Regards

    Arti,
    MBEWH table will get you the MAP of a material monthwise,I guess you need to get the logic which will use those details to arrive on MAP for a paritcular date.
    Check the SDN Forums with the keyword "MOVING AVERAGE PRICE REPORT" to get some lead.
    moving average price report
    K.Kiran.

  • Moving average price  based on date range, site and article.

    Hi ABAPers,
    I am working on SKU wise sales report. Based on user input of date range ,site and article I fetch data from VBRP table i.e., (billing data from stores) . I have searched a lot to find MAP but dint get convincing solution.
    I tried to get data from MBEW-VERPR but that doesnot give MAP for a given date. I also tried with condition record table and KONP table but not helpful.
    I also got to know about s031 and LIS configuration I am not sure whether functional consultant should do the changes.
    Kindly help me in obtaining the MAP for particular bill date, article and site(store).
    Regards,
    Dep

    You can found the moving average price in MBEW (current) and MBEWH (history table)
    The first goods movement after the period closing program updates the period in MBEW and writes the data of the previous period to table MBEWH
    - If you actually need map on a daily (or less) basis, you will have to calculate it from MBEW, MBEWH, MSEG and BSIM (...)
    - You could also look for the actual cost in MSEG related to records of VBRP.
    Regards,
    Raymond

  • Does moving average price work with multiple valuations?

    Dear All,
    I have activated multiple valuations: Legal, group and profit center.
    I have activated ML/Actual costing for this multiple valuations too.
    Now I have 3 price fields in material master.
    Could I use moving average price for some materials types in multiple valuations?
    Thank you,
    With best regards,
    Kamila.

    Hi Kamila,
    yes, ML is always activated for all materials in a plant. To use MAP you have to set the price determination of a material to '2':
    This is the F1 help of the field price determination:
    Material Price Determination: Control
    Specifies how the material price determination should procede.
    You have the following options:
    With price control V in activity-based material price determination (indicator2 in the material master), the moving average price is calculated. With price control S, the material is valuated with the standard price and the moving average price is calculated for information purposes.
    In single-/multi-level material price determination(indicator 3 in the material master), the valuation price (standard price) remains unchanged and a periodic unit price is calculated for the closed period.
    This option is only for materials with price control indicator S,and is only recommended if in addition to multiple currencies and/or valuations, you use single-/multi-level material price determination.
    In single-/multi-level material price determination, a periodic unit price is updated for information, but it can only be used for material valuation in the closed period.
    Dependencies
    The indicator is only of use if the material ledger is active.
    Upon activating a valuation area for the Material Ledger in Customizing, you can enter what type of material price determination will be proposed when creating a material in that valuation area. This proposal will be ignored at production startup: the system automatically sets the indicator to 2 in the material master for all materials present.
    If you want to change the indicator for a particular material later, choose Accounting -> Controlling -> Actual Costing/Material Ledger -> Environment -> Change Material Price Determination.
    best regards,
               Udo

  • 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

  • Moving Average Costing

    My clients business buys used equipment on the secondary market that they refurbish & sell. The prices fluctuate pretty dramatically based upon supply and demand; so it really isn't possible to set a standard cost that would be valid throughout the year. Using standard costs results in huge fluctuations in the inventory purchase price variances month over month and quarter of quarter. Therefore, we explored using moving average costing.
    Could someone help me get the moving average to update using PM04, Does SAP actually recommend against using moving average costing?

    Charlie,
        Thanks for your response. If I understand you right, you are suggesting doing STD pricing every month or quarter instead of attempting MAP? Is that right?
    Vishnu

  • Error in "Inventory Valuation Method using Moving Average"

    Dear Sir,
    Here I am using moving average as inventory valuation method at one of my client. I want to know that in SAP Business One, in case of F.G. valuation we can only get the valuation of Raw Material and not the direct expenses cost.
    Can you please tell me how should i put the Direct Expense Cost (e.g. Labor Rate) in F.G. inventory Valuation?
    Please reply ASAP.
    Thanks & Regards
    SS

    Hi,
    Only the raw material cost will be added to the Cost of the FG based  on the Quantity and price in the BOM.
    Ex:
    To make Parent Item FG 1 nos , you required 2 nos of Child Item of Rs 10 each,
    Create Bom for the same and refresh the cost of the FG (will find a refresh arrow in the Bottom of the BOM -Screen)
    Once you Issue child parts to the respective production order and make  a receipt for the Parent Item the cost of the FG will be posted as RS 20
    If you want to add the labor cost to the FG there is no direct provision to add the cost in SBO, we have give a work around only as follows.
    Create a Service  Item ex.Labor Cost and give the Standard cost for that Item in inventory tab For example for Rs 200/Hr
    Now add the Service item (Labor Cost) in the Bill of material and in the Quantity field  give the Time for the labor required is if the Labor Time taken is 30 min to make 1 FG give 0.5 ie (convert the cycle time to Hours and give the decimal value)
    then refresh the BOM,
    Now the cost of the FG will be 20+100( labor cost) = 120
    The above method can be used only if you have determined a standard time of labor to manufacture,
    With regards,
    G.Eshvanth Singh

Maybe you are looking for