BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
UberBock

Occasional Contributor

Joined:

Jan 11, 2019

Calculate moving average

I have a table which has 720 columns of data (plus other columns) and want to create 715 additional columns that have the moving average of the data.  So columns R001,R002,R003,R004,R005 would be averaged to yeild T001 nfor each row in the table.  Then R002,R003,R004,R005,R006 average would yield T002 etc...  I then have a script to graph any selected row by the T data points.  Anjy how I can create a script that I can add to a data table to do this manipulation? 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Calculate moving average

Replace the Lag() function with the Col Moving Average() function and you will get what you want
Jim
4 REPLIES 4
txnelson

Super User

Joined:

Jun 22, 2012

Re: Calculate moving average

It seems as if your data are 90 degrees rotated from what they should be. How many rows of data do you have when you have the 720 columns?  

 

If you transpose your data, doing what you want will be a simple task, as will the graphing of the results.

Jim
UberBock

Occasional Contributor

Joined:

Jan 11, 2019

Re: Calculate moving average

I saw that the script for graphing does transform the data.  It can average and lag to show the correct data for 1 line but with more than 1 it has issues.  I supposed I can subset the needed columns with a primarykey; transform it do the average; rotate back and rejoin to the main table by the key.

txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Calculate moving average

Replace the Lag() function with the Col Moving Average() function and you will get what you want
Jim
UberBock

Occasional Contributor

Joined:

Jan 11, 2019

Re: Calculate moving average

Thank you that worked.