"moving average" function
is there any "moving average" formula to the functions area ?
Pedi
You can build your own moving average calculation. Not difficult, just define the range for the AVERAGE function and then Fill the expression down the data column.
Jerry
Similar Messages
-
Moving Averages in Labview SignalExpress
Hi everyone,
I am measuring power consumption values from a PC system at 25k samples/sec and looking for a way to calculate the 1-sec and 5-sec moving averages via Labview SignalExpress (Unfortunately I don't have Labview to custom-implement this). One person suggested using FIR low pass filter instead, but I am not quite sure what values I need to set for "number of taps" and "cutoff frequency" values to have it act like a 1-second and 5-second moving average. Any suggestions here?
Also, does anyone have a .VI from Labview for a moving average functionality, which I can use in my Labview SignalExpress setup?
Thanks,
--SerhanSerhan,
If you are just aiming to smooth out your signal and reduce noise, than an FIR filter would work fine, but it sounds like you are trying to achieve an exact moving average. Unfortunately, there are entire textbooks on filter design and getting the filter to accomplish that with great accuracy would be a feat. It is true that the moving average is a form of the FIR filter.
I had some old code that took the running average of 100 samples in SE, but I'll have to look for it when I get to work tomorrow. I'll post again when Ifind it.
I don't have any moving average VI's handy, but that would probably be the easiest way to accomplish this. Maybe someone can distribute their VI to Serhan?
Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video -
Performing math on Decode function tags and moving averages
I have a query shown below to create columns for my report. Can I use the field names as shown in bold to perform math functions? Is there an easy way to do this?
select Data_date,
SUM(DECODE(tag_id,'SEF_F0348I',avg_value,NULL))"TE_Flow_mgd",
SUM(DECODE(tag_id,'L_STEbod_con',avg_value,NULL))"TE_BOD_mgl",
"TE_FLOW_mgd" * "TE_BOD_mgl" * 8.34*.45359 as "KG_BOD"FROM daily_tag_data
Where data_date >= to_date('12/31/2002','mm/dd/yyyy')
GROUP BY data_date;
Also how would I perform a seven day moving average on "KG_BOD"
Thanks - Very new at this.If you want avoid a sub-query, try this...
select Data_date,
SUM(DECODE(tag_id,'SEF_F0348I',avg_value,NULL))"TE_Flow_mgd",
SUM(DECODE(tag_id,'L_STEbod_con',avg_value,NULL))"TE_BOD_mgl",
SUM(DECODE(tag_id,'SEF_F0348I',avg_value,NULL)) * SUM(DECODE(tag_id,'L_STEbod_con',avg_value,NULL)) * 8.34*.45359 "KG_BOD"
FROM daily_tag_data
Where data_date >= to_date('12/31/2002','mm/dd/yyyy')
GROUP BY data_date;
just replace the 'column-alias' with the actual arithmetic fuction... -
I've created a time series graph on numbers on my iMac but I need to add moving averages. Is there a function an if so where is it and if not is there a way to get around it
Badunit,
Here is an example plot, data sorted from most recent data at top of the table...
You can see the moving average (of 20) is plotted from right to left.
The Moving Average calculation is now wrong, and should have been calculated and presented from oldest to most recent.
Here is the same data, with table sorted from oldest data at the top of the table.
The moving average is also plotted from right to left, and shows the correct Moving Average for the most recent data.
That is, it is calculated from oldest to most recent, with the last Moving Average data point plotted on "todays" date.
What I want to see is my table displayed from most recent at the top (the top table), and moving average calculated and displayed as per the bottom graph.
Edit: So, think about this some more,
I need an option to tell Numbers to do the Moving Average calculation from the bottom of the table up, not from the top of the table down. -
Function module to update Moving Average price for Material?
Hi guys,
is there a function module or BAPI to update the moving average price in a material master?
i have tried UPDATE_MATERIAL_PRICE but guess it does not work. I have also tried MB_UPDATE_MATERIAL_PRICE and it seems to not work. Any pointers?We have a need to update the moving average price using movement type 531 for a custom solution we have built for other business requirements. We have not found a way to update the moving average price yet using any of the information provided here. Can any offer any other suggestions. Looking for a BAPI, user exit, or function module that we could tap into in order to updat the moving average price. Here is what we found...
We believe that the following suggestions doNOT apply...
BAPI_MATERIAL_SAVEREPLICA is basically for updating material master records in general. It does not address the offset to the alternate accounts.
BAPI_COSTESTIMATE_UPDATE_PRICE does not adjust the moving average price.
CIML_UPDATE_MATERIAL_PRICE updates Project Stock.
Any help would be greatly appreciated. -
Inventory Controlling - Get history moving average price function - Urgent
Dear Experts,
Currently I have an issue that I want to calculate material history value at storage location level for each month. I tried to get history stock quantity and value from table S031, stock quantity is correct. But stock value (goods receive value minus goods issue value in table S031) is not correct.
Client requests the resulet should be same as transaction code MC.9 (valuation selection - standard). But what the result I got from table S031 is the value that without disctribution. Currently I do not know how MC.9 calculate stock value.
Does any expert know if there is a funciton that can get history moving average price. I may use this price multiply history stock to get history value. Thanks
Best Regards
AngelaHello,
Moving average cost history is available in MBEWH-VERPR.
Thanks,
Venu -
SSRS 2008 R2 - Add moving average to column group
I have a column group of dollar amounts. The row is a year/month. I would like to add a moving average column to the right of the last 6 months. My SQL Server data source is already complex enough and I'd really prefer not to add a column
there. Is there anything I can do within the report itself? Some way to reference the previous records in a matrix?
Thank you!Hi mateoc15,
According to your description, you have a matrix in your report. Now you want to calculate the average value of last 6 month. Right?
In Reporting Service, we can put custom code into report to deal with complicated logic. Add one more column/row inside of group and call the functions defined in custom code. For your requirement we modified Robert’s code to achieve your goal. We tested
your case in our local environment with sample data. Here are steps and screenshots for your reference:
Put the custom code into report:
Private queueLength As Integer = 6
Private queueSum As Double = 0
Private queueFull As Boolean = False
Private idChange As String=""
Dim queue As New System.Collections.Generic.Queue(Of Integer)
Public Function CumulativeQueue(ByVal currentValue As Integer,id As String) As Object
Dim removedValue As Double = 0
If idChange <> id then
ClearQueue()
idChange = id
queueSum = 0
queueFull = False
CumulativeQueue(currentValue,id)
Else
If queue.Count >= queueLength Then
removedValue = queue.Dequeue()
End If
queueSum += currentValue
queueSum -= removedValue
queue.Enqueue(currentValue)
If queue.Count < queueLength Then
Return Nothing
ElseIf queue.Count = queueLength And queueFull = False Then
queueFull = True
Return queueSum / queueLength
Else
Return (queueSum) / queueLength
End If
End If
End Function
public function ClearQueue()
Dim i as Integer
Dim n as Integer = Queue.Count-1
for i=n To 0 Step-1
queue.Dequeue()
next i
End function
Add one more row inside of group, call the function defined in custom code.
Save and preview. It looks like below:
Reference:
Moving or rolling average, how to?
If you have any question, please feel free to ask.
Best Regards,
Simon Hou (Pactera) -
Moving average price not updatet when sales order stock
Sales order stock is ioncluded in calculating moving average (at goods receipt there is no new valuation type created)
It is okay with replenishment orders (regular stock)
I first thought it had to do with Spec. Stk Valuation indictator (but this one is set to 'M', which seems right for me.
Does anyone have a clue what I can do so my moving average value is also calculated based on sales order stock and not only regular stock?
Kind Regards
Kevin
Edited by: Kevin Gielen on May 5, 2010 2:44 PMSpl Stock Valution must be - A (not M) to valuate along with normal stock .
Ensure following configuration is there
1. create Requirement class in OVZG . Maintain required account assignment category under account assginment subscreen
2. Create requirement type in OVZH . assign this req.class to req.type
3.Assign requirement type to sales item categories for which you need this VSO functionality
4.Goto SM30 and give table V_T459K_K ,mainatain ,for your requirement class under valuation field maintain M or A(put F1 for moreinfo)
5.Take SD consultant help to setup schedule line category(SC) for this item category ,it should have account assignemtnt category and PR order type - VOV6 and assign this SC to item category in VOV5
6. Now create SO which will populate the above created item category (if not check with SD consul to populate the above item category)
7.convert the PR generated through above SO into PO
8.In PO under account assignment tab you could see BSX account and it must be greyout .
9.Do GR ,stock will be updated in MBBS report.
it resolves your requirements
check point in each transaction:
after SO ,check VBAP- KZBWS = M or A (which you have maintained in requirement class)
PR from SO, EBAN-KZBWS =M or A and PO also will have EKPO-KZBWS = M or A -
Product Costing using Moving Average Price of FERT & HALB
Dear Experts,
My client wants to use Product Costing functionality by using Moving Average Price instead of Standard Price on Finished Goods & Semi Finished Goods and as per my understanding, SAP recommends to use Standard Price on FERT & HALB.
I know if we use moving average price instead of standard price than there will be no concept of variances. Can anyone tell me more about what are the pros and cons of using moving average price instead of standard price in Product Costing?
Thanks in advance.
Regards,
Zain BashirHi Zain
Let's take an example
You have V for Mat A
You create 3 Prod orders in a month
Order 1 - Qty 10 - variance 100
Same for Order 2 and 3..
At month end, you sold 20 pieces and 10 is in stock..
When you settle order 1, system will compare order qty and stock.. It will match I.e. 10 = 10... Hence variance of 100 will be posted on stock
Same will happen for Order 2 and 3... Ideally, only 100 should have posted on stock... but in this case 300 of variance will be posted on stock...
This is what the note mentioned by Arturo tells, but not so clearly
Hope this helps
Br. Ajay M -
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? -
I'm tasked to create a SCOM Monitor MP that needs to be deployed on different servers where it needs to count events in the eventlog and trigger an alert.
Before it is suggested that counting an absolute arithmetic difference is enough and offering links to such solutions, there is a "gotcha!" :
There might be one server, Server A, that gets, say, 1000 events per hour, an increase of 100+ should trigger the alert.
On Server B, only gets 100 events per hour, and an increase of 10+ should also trigger the alert.
Therefore: You *can't* use an absolute diference, but *must* use a percentage difference.
It gets more challenging as there is another "gotcha":
Actually what should trigger the alert is a rate increase of events that falls outside of two Standard Deviations of a Moving Average. The best example is the stock market: Your stock price moves up and down daily, but also steadily moves up due to
inflation over the years. You want a monitor that will alert you when the stock price goes above or below two standard deviations from the *moving average*.
I know how to call a PowerShell script from a SCOM Monitor, but I don't know how to get SCOM and PowerShell to "remember" prevous sampling's counts, because Monitors are state-less (e.g. "memoryless") .
Since SCOM, I'm told, can monitor any process state over time, I'm surprised that I don't see any support for statistical time-series analysis .
Any help would be appreciated.Hi,
beyond advanced topic! That's what I like.
First, very good description, these are almost functional specifications!
I would also chose PowerShell.
Some time ago we did a similar situation - where
it was necessary to take into account the previous
situation|state.
We resolve this in a way that the states|values was
stored in the dedicated text file. So, at each new interval we collect new samples, read previous samples, calculate required values, stored this new calculated values, if required create property bag and trigger alert.
This is of course high level view. But in general the entire process is done in PS script.
Recently, I found that
the xml files and PS scripts bring
a lot of flexibility. Especially in building custom
diagnostics.
And there is no need to care about distribution of this files,
they may be included in the MP.
So SCOM infrastructure take care of this.
One piece of advice: First decide
whether you need only alert
or you want to steer|change health. The first case
is simpler - you need rule. The second is more complex - you need monitor!
But of course the main part is PS script.
Regards,
Ivan -
Is it possible to change the costing from moving average to standard??
hey all,
i wana know is it possible to change the costing from moving average to standard or vice-versa in the item master??
cheersHi Satish
Please look at the documentation from SAP for using this function. I just looked on my drive and can't find the document I used to have for this.
Just setting quantities to zero will not work as all open P/O, S/O, etc must also be closed before you can run the Inventory Valuation Method function. This is all detailed in the document.
I have done this successfully before for a client with over 4000 items, so I have been through the process. Please let me know if you need assistance.
Kind regards
Peter Juby -
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
ChrisHi 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 -
Hey everyone,
I've got the following scenario going on:
A pivot table that has a product hierarchy and quantity sold along with a 5,10 and 20 day moving average. At the base level of the hierarchy (i.e. you haven't drilled into anything yet), the moving averages work correctly.
But once you drill into the different product levels, the moving averages immediately stop making any sense. It's almost as if they are precomputed in some other order and then reorganized into a order that no longer makes mathematical sense.
Does anyone know why this happens?
Can anyone recommend how to get it to function as I would expect it to?
thanks everyone!
-JoeSerhan,
If you are just aiming to smooth out your signal and reduce noise, than an FIR filter would work fine, but it sounds like you are trying to achieve an exact moving average. Unfortunately, there are entire textbooks on filter design and getting the filter to accomplish that with great accuracy would be a feat. It is true that the moving average is a form of the FIR filter.
I had some old code that took the running average of 100 samples in SE, but I'll have to look for it when I get to work tomorrow. I'll post again when Ifind it.
I don't have any moving average VI's handy, but that would probably be the easiest way to accomplish this. Maybe someone can distribute their VI to Serhan?
Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video -
Moving Average in a Report Section
Hi there,
I am displaying a measure in a chart that has three data points. The measure is 4 day moving average of a metric. Let's say my query brings back the last 6 days, which enables me to calculate the 4 day moving average for days 4, 5, and 6.
I use the Previous() function to calculate the moving average:
=(metric + Previous(metric) + Previous(Previous(metric)) + Previous(Previous(Previous(metric)))) / 4
I don't want to show days 1, 2, and 3, so I filter these out of the chart and wrap a NoFilter() around the moving average. Everything is good so far.
The problem arises when I section on a dimension. I can't seem to get the correct values unless I display all 6 data points in each section. NoFilter() doesn't seem to work.
Has anyone run into this before? Does there exist a solution for this?
Any help would be greatly appreciated.
Thanks,
AllanI figured it out:
NoFilter([[4wkMvAvgMeasure]]) ForEach ([[day]]) In Section
Thanks,
Allan
Maybe you are looking for
-
How do I do a mass change of face names in iphoto? For example, I have 500 pictures named Michelle Smith, but she is married and is now Michelle Johnson. How do I change all the photo face names to the new name en masse?
-
Strange issue - XI somtimes process a file and sometimes its not detected
Dear friends, We have a strange problem. Ill describe the situation: We have a simple file to file scenario without any mapping or File Content Conversion. Daily a sender system puts a ZIP file on a server and XI processes this file. The strange thi
-
When I add a phone-number, I can't define it as 'iPhone'.
When I add a contact, and that person is also using iPhone, I can't define that. I can choose all kinds of things, like radio, fax, home, mobile,.. but not iPhone... This also means I can't use iMessage whit that person. How can I change this?
-
The latest update included an update for my printer. Now the scanner won't work. Any advice. Dave
-
Default code for Codegroup on support message
Guru's Is there a way to default the code selected for codegroup on transaction SLFN and ensure certain fields are set as marked as required during message administration?