MCTampa
Board Regular
- Joined
- Apr 14, 2016
- Messages
- 97
Good afternoon,
I have a table for GET_CONF and GET_CXL.
I have calculated a 7-day moving average for GET_CONF using the following:
All i want to do is have the 7-day average for GET_CXL added to the table.
I assume I have to perform an inner-join, but I continue to get an error.
I simply want to use the same formula and add the GET_CXL portion.
Thanks,
Mike
I have a table for GET_CONF and GET_CXL.
Date | GET_CONF | GET_CXL |
01-Jan-20 | 1 | 1 |
02-Jan-20 | 1 | 2 |
03-Jan-20 | 2 | 9 |
04-Jan-20 | 5 | 4 |
05-Jan-20 | 6 | 1 |
06-Jan-20 | 4 | 9 |
07-Jan-20 | 3 | 6 |
08-Jan-20 | 5 | 6 |
09-Jan-20 | 10 | 9 |
10-Jan-20 | 13 | 8 |
I have calculated a 7-day moving average for GET_CONF using the following:
VBA Code:
SELECT o.Date, o.GET_CONF, o.GET_CXL
(
SELECT avg(GET_CONF)
from Output i
Where i.Date <= o.date
and i.date >= (o.date - 6)
having count (*) >=7
) AS GET_CONF_AVG
FROM [Output] AS o;
All i want to do is have the 7-day average for GET_CXL added to the table.
I assume I have to perform an inner-join, but I continue to get an error.
I simply want to use the same formula and add the GET_CXL portion.
Thanks,
Mike