Questions tagged [rolling-average]
104 questions
0
votes
1 answer
How can I get information about moving average?
I want to calculate moving average for my project. But I don't understand this blew codes. How can get more information about moving average codes?
cx <- c(0, cumsum(ifelse(is.na(x), 0, x)))
cn <- c(0, cumsum(ifelse(is.na(x), 0, 1)))0
rx <-…
user15820991
0
votes
0 answers
Moving average with adaptive window size
I have a DataFrame df with two columns x and y which I would like to plot as a line plot as follows:
import matplotlib.pyplot as plt
import seaborn as sns
fig = plt.figure(figsize=(9, 7))
ax = plt.subplot(111)
df = df.groupby(x,…

machinery
- 5,972
- 12
- 67
- 118
0
votes
0 answers
Calculating Monthly (Offset) Average In Excel
I have daily data entries for 3 indices. They do not feature every day of the month and for some days entries for one of the indices will miss; the quantity of cells per month differ. I want to calculate the average value for these individual…
0
votes
1 answer
SQL Moving Average over specific time
I'm working with Impala and Hive, so I don't know if I have fancy functions that Oracle or MSQL provide
So , having a table of values and timestamps
|-----------|------------------|
| value | timestamp |
…

habarnam
- 78
- 6
0
votes
2 answers
How to produce a year over year calculated column in R
First, is the data and then the manipulations. Finally, is the current method that I am using and as of yet is producing no data. The manipulations are to create a date and then create a rolling 12-Month average.
Monthavg<-
…

Tim Wilcox
- 1,275
- 2
- 19
- 43
0
votes
3 answers
Rolling avergae for aggregated results in R
I have a database with sales value for individual firms that belong to different industries.
In the example dataset below:
set.seed(123)
df <- data.table(year=rep(1980:1984,each=4),sale=sample(100:150,20),ind=sample(LETTERS[1:2],20,replace =…

lovestacksflow
- 521
- 3
- 14
0
votes
1 answer
Rolling N monthly average in Redshift with multiple entries per month
I would like to use Redshift's window aggregation functions to create an 'N' month rolling average of some data. The data will have multiple unique entries per any given month. If possible, I'd like to avoid first grouping by and averaging within…

Elizabeth
- 199
- 1
- 4
- 13
0
votes
1 answer
Calculating Moving Average for N Months in DAX Power BI
I have a measure that calculates Moving Average for 3 months:
Moving_Avg_3_Months = AVERAGEX(DATESINPERIOD('Calendar FY'[Date],
LASTDATE('Calendar FY'[Date]), -3, MONTH),[CUS Revenue Credible All])
Is it…

Hell-1931
- 489
- 1
- 6
- 24
0
votes
1 answer
How to improve the performance of this MySQL 7 day rolling average query?
I have the following query which calculates a 7 day rolling average, however currently it takes 4 minutes to run due to the WHERE b.serverId = a.serverId line. My question is how can I improve this query so that it takes miliseconds to seconds? The…

Lukasz Dabrowski
- 85
- 2
- 6
0
votes
2 answers
Google Sheets - Finding the average of lowest 8 values from 20 most recent (rolling)
new to all this.
Doing a golf spreadsheet and need to find out the average of lowest 8 rounds from the last 20 rounds.
As I add in another scorecard, the calculation will move along etc.
Any ideas on how I can get started?
Thanks in advance

Jonty
- 45
- 1
- 7
0
votes
1 answer
How to reject a window containing an outlier with a condition during rolling average using python?
The problem that I am facing is how i can reject a window of 10 rows if one or many of the rows consist of an outlier while computing rolling average using python pandas? The assistance i require in is the conditional logic based on the following…
0
votes
3 answers
Calculate rolling 180 days average
We have a table with columns TXN_DATE and NO_OF_TXNS. Below is sample data:
TXN_DATE NO_OF_TXNS
25-AUG-19 0
26-AUG-19 1000
27-AUG-19 1500
28-AUG-19 1800
29-AUG-19 1100
30-AUG-19 …

Sid
- 582
- 3
- 7
- 28
0
votes
1 answer
CTE Rolling 3 Mo Avg
output for all 3 queries
working on an assigment, below is the ask, she has directed us to use a CTE
Write SQL query code used to explore the database tables and write a query that retrieves finance amounts from "FactFinance" in the…

Alicia Chavez
- 1
- 1
- 3
0
votes
0 answers
How to get these moving average results
I am trying to get moving average in this format
Where NA stays NA otherwise show average of three periods but for the first and second period assume the missing values to be extension of existing value.
I am trying the rollmean and rollapply…

DashingQuark
- 105
- 8
0
votes
1 answer
How to compute a rolling average by rank (not row) in Teradata?
I have the following table in Teradata:
ranked | data_val
-------- ----------
1 | 100
2 | 30
2 | 20
2 | 70
I want the following table, where avg_val is the rolling average of data_val values ordered by increasingly…

Sam Y
- 30
- 3