Moving Average - How To Calculate Values From Column
Aug 13, 2013
Is there any formula or any way to calculate moving average on access? What I need is to calculate a value based on data from the past 3 months:
I have following structure for example:
Column A ----- Column B -------- Column C
ValueA1 ------- Value B1 ---------
ValueA2 ------- Value B2 ---------
ValueA3 ------- Value B3 --------- =average (ValueB1, valueB2, valueB3)
ValueA4 ------- Value B4 --------- = average (valueB2, valueB3, valueB4)
My main point id how to calculate values for column C.
View Replies
ADVERTISEMENT
Aug 16, 2015
I found the attached example a while back (can't find the site again though ) and it calculates a moving average. I've hacked out the parts I need for my own work and I can create my moving average query without an issue.
However, I need to extract the MA data into a table so planned on using append. I kept getting type errors so I tried make table to see what type it was creating and it appears to be Short Text rather than a number.
I've added an extra button and Make Table query to the example.
As far as I can tell from the code, the moving average value when calculated is a Single. However, when I write it to the table, its a Short Text.
How do I make the created Table use Number Type for my calculated moving average?
Using Access 2013
View 2 Replies
View Related
Jul 4, 2013
I have a report that comes from a query with multiple expressions. The expressions look something like this:
IIF([TimeArrive]>[TimeTriage],DateDiff("n",[TimeArrive],[TimeTriage])+1440,DateDiff([TimeArrive],[TimeTriage]))
This works great and my report gives me my columns for each expression in minutes they way it should. Now here is the question...is there a way to insert a text box for each column/expression so I can calculate the Average for each column/expression?
i.e. I want the report to show the average minutes of Expr1 and Expr2, etc at the bottom of each column.
View 2 Replies
View Related
Dec 3, 2013
I have a query that pulls data from a table called Data. I'd like to add a column to the query that will be the moving average -- For example, for a Month Beginning Date of 12/2013, it would average the SumOfCount variable for 10/2013, 11/2013, and 12/2013.
This is the sql code for my query without the moving average:
SELECT Data.Behavior, Sum(Data.Count) AS SumOfCount, Data.[Month Beginning Date], [First Name + Last Name].Wing, Data.[Full Name]
FROM Data INNER JOIN [First Name + Last Name] ON Data.[Full Name] = [First Name + Last Name].[Full Name]
GROUP BY Data.Behavior, Data.[Month Beginning Date], [First Name + Last Name].Wing, Data.[Full Name]
HAVING (((Data.Behavior)="PRNs") AND ((Data.[Full Name])=[forms]![report parameters]![fullname]));
How to insert that column into my code?
View 14 Replies
View Related
Jan 17, 2014
I'm trying to understand loops but I'm not making any progress. I'm trying to write a loop to calculate the average of the past 10 Values including the current Value. This is what I have so far.There are also Fields for "Date" and "Time" if that is useful.
[code]
Dim index As Integer
Dim RollAveTotal As Long
Dim CurrentValue As Variant
Do
'There are 4 possible Grades. I only need "Grade 1"
[code]
View 2 Replies
View Related
Feb 25, 2008
Hi. I have a question I'm hoping someone can help me with. I would like to take data from multiple columns and put the data into one column. Additionally, I do not want to exclude any data (union all) and I would like to group the resulting union by another field. For example:
Original data layout:
Column Headings: Sample Event, Depth 1, Depth 2, Depth 3,
1st Row Data: 1, 6, 9, 12, 9
2nd Row Data: 2, 7, 9, 8, 3
Desired data layout:
Column Headings: Sample Event, Depths
1, 6
1, 9
1,12
1, 9
2, 7
2, 9
2, 8
2, 3
So far I'm using the following SQL. What do I need to add or change to get my desired result of grouping the unioned depths by the 'sample event' field?
I appreciate any help anyone may have to offer. Thank you.
SELECT Depth1 AS Depths
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth2
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth3
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth4
FROM Depth_Velocity_Substrate_Correct
Union all
SELECT Depth5
FROM Depth_Velocity_Substrate_Correct
View 5 Replies
View Related
Jan 16, 2007
Hi,
I need to calculate an average waiting time for patients waiting to be seen in an A&E dept between two dates.
I have calculated the total waiting time for each patient with the following formula
Total Waiting Time: Format([Time Arrived]-1-[Time Left Department],"Short Time").
Any help much Appreciated
View 10 Replies
View Related
Jun 20, 2007
I hv a access mdb which contains one column as "duration", data format as hh:mm:ss, e.g. 00:02:20 - 2 mins 20secs.
How could I calulate the average of the duration?
like sum of all duration fields / the ttl no of records.
View 1 Replies
View Related
Feb 19, 2013
Currently using a lot of Power Pivot Tables which in part calculate "averages" - but when the data comes form a Query that contains a calculated field using the iff() funtion such as: Outcome: iff(Status = "P", 1,0) we end up with a lot of zeros that create a problem in calcuating a true average. In the following example 2,3,0,1,0,0 the average is "1" but if the zeros were blank the average would be "2" because the blank cells would not be counted.
Is ther a way to have something like: Outcome: iff(status = "P",1,"blank") but what I want is ether 1 or a blank cell, NOT TEXT. If we use "" for the false outcome we still have cells that look blank but are in fact text cells and are counted in calculating average.
View 6 Replies
View Related
Oct 28, 2012
I need to calculate the average repaired time and the average response time. These are two separate fields ....
View 1 Replies
View Related
Apr 9, 2014
I obtained data for earnings by industry for men and women over time (5 years). I developed crosstab query that showed the average earnings for men and women for the 5 years.
Now I want within this query to calculate the differential between men and womens average earnings and calculate a percentage within this crosstab query. I tried to use Expressionbuilder with little luck.
View 6 Replies
View Related
Aug 2, 2012
I am still quite new to Access and have spend the last two days looking for a solution to an issue but don't seem to find anything that fits. The problem is that I want the three year average of [NIbyA] inserted in [AvgNIbyA]. The years are stored in [FocalYear] (as Date/Time formate) and [TextYear] (as text formate) and [ID] indicates which entity the record belongs to (see below).
UniqueID
ID
TextYear
FocalYear
NIbyA
AvgNIbyA
1020180-19981231
1020180
19981231
[Code]...
Example.accdb
I have been playing around with update queries but can not seem to get the syntax right. The query needs to add NIbyA for year 1998, 1999 and 2000, divide it by 3 (or use Avg() function or something of that sort) and insert the result into the row where [FocalYear] = 13/12/2000. To add to the confusion, it should obviously only add those records that belong to the same ID. Years are from 1998 to 2010 and ID's are random (this obviously means that the rows where [FocalYear] = 13/12/1998 and [FocalYear] = 13/12/1999 will not have an entry).
View 11 Replies
View Related
Dec 21, 2011
I have an Excel sheet with data organized like:
1 A
1 B
2 A
2 B
2 C
I want to reduce the first column to unique records, and have the second column listed on the same row. (I'm assuming I'll need Access to do it.) Is there a way to produce a table like this?
1 A B
2 A B C
The final result would need to be something I could put back into Excel.
View 3 Replies
View Related
Aug 10, 2015
Is it all possible to create the equivalent of a combo chart in Excel in Access?
What I need is a graph showing a certain dataset as columns but also a line showing the average for that set.
As an example lets take an exercise programme in a school, each child performs a series of exercises every week and data is recorded, to monitor their fitness progression.
Lets say I wanted to show a graph of one particular exercise, with the class students listed along the x axis, and then show the class average for that exercise dataset as a line on the same graph.
View 3 Replies
View Related
Feb 7, 2008
How can I move multiple columns data into a single column so that:
Name Age Location
Mike 25 Essex
Jack 32 Surrey
Bob 36 Newcastle
appear in a single column with data appended column-wise as
Mike
Jack
Bob
25
32
36
Essex
Surrey
Newcastle
Any help would be much appreciated. I'm a novice at VBA, so if anybody could do the code, it would be great!
View 3 Replies
View Related
Feb 7, 2008
How can I move multiple columns data into a single column so that:
Name Age Location
Mike 25 Essex
Jack 32 Surrey
Bob 36 Newcastle
appear in a single column with data appended column-wise as
Mike
Jack
Bob
25
32
36
Essex
Surrey
Newcastle
Any help would be much appreciated. I'm a novice at VBA, so if anybody could help me with the code, it would be great!
View 14 Replies
View Related
Jan 20, 2012
I have a large amount of field data that was taken by a data logger. Specifically, The datalogger has five temperature probes embedded in soil, and takes a measurement automatically once every hour for each probe. So the table has a Time field, and then a Temp1, Temp2,... Temp5 field. I need to be able to average the temperature fields. This within itself is easy enough, I just tell the query to find (Temp1+Temp2+...+Temp5)/5. However, unfortunately, because it is field data is is very common for one (or more) of the ports to be malfunctioning at any one measurement time for a number of reasons.
If, for instance, Port one does not have a value, then the formula I entered will not work, as it can't add a null value to numbers, and otherwise It would be dividing by five whereas there were only four values to average.
View 3 Replies
View Related
Mar 5, 2007
Hi all,
In the organisation that I work for employees get paid every 2 weeks on a Saturday. So for this financial year the pay period end dates have been 08/07/2006, 22/07/2006, 05/08/2006 etc
I have a column in an Access table listing various dates. I want the next column to be
populated with the next pay period end date after that date.
So if DATE is 05/07/2006 I want PAY PERIOD END to be 08/07/2006
and if DATE is 09/07/2006 I want PAY PERIOD END to be 22/07/2006 etc
How do I do this?
Kind Regards,
Matthew
View 1 Replies
View Related
Apr 23, 2013
I'm trying to get this query to work:
Code:
SELECT Avg(Round([Final 205].[LastOfSumOfRehLOS],2)) AS AvgInpLOS, Avg(Round([LastOfSumOfWaitLOS],1)) AS AvgWaitTime, Count([Final 205].PHN) AS Observations, [Final 205].LastOfIntensity AS Intensity_Level
FROM [Final 205]
GROUP BY [Final 205].LastOfIntensity;
It doesn't found the result to two decimal places.
View 1 Replies
View Related
Jan 30, 2014
In my table for duplicate "line no" I have different "contractor" like below.
LINE NO CONTRACTOR
L-0001 C-1000
L-0001 C-2000
L-0003 C-6000
L-0003 C-8000
L-0003 C-9000
L-0004 C-5000
Now I would like to make a query for transposing values like below:
LINE NO CONTRACTOR1 CONTRACTOR2 CONTRACTOR3
L-0001 C-1000 C-2000
L-0003 C-6000 C-8000 C-9000
L-0004 C-5000
how I have to make this query?
View 1 Replies
View Related
Dec 4, 2011
I have this table ("people") and an example of possible rows:
id(key) COL 1 COL2 department country name
1 xx yy KPP USA John
2 zz kk KPP USA John
3 ss ff TLL USA John
4 ww qq PPO Italy Marco
5 jj uu PPO Italy Marco
I have to count the number of distinct DEPARTMENT for each NAME; so, for John should be 2 (KPP and TLL) and for Marco 1 (PPO).
I have tryed in this way:
SELECT
COUNT(DISTINCT department) AS NumberOfDifferentDepartments
FROM people
GROUP BY name;
But Access says me there is a syntax error.
I'm working with MS Access 2002.
View 2 Replies
View Related
Oct 26, 2006
Does anyone know how to add a column to an existing table that would calculate percentage?
Thank you very much in advance!!!
View 3 Replies
View Related
Aug 12, 2013
I have a database of spare parts and I want to calculate the price of the whole warehouse.I have managed to do [quantity]*[price] in a subform but now I want to sum all and show the result in textbox.
View 11 Replies
View Related
Aug 7, 2012
i am trying to clean up all unneccessary queries. i am now trying to get a calculation to apear in a text box.
what i want to calculate is [tblReceipts].[ReceiptCash] If Date()= [tblReceipts].[DateOfReceipt]
am i going about this the wrong way of is my pricipal correct but my expression wrong?
View 13 Replies
View Related
Oct 20, 2014
tell me if it is possible to calculate a value in a column in a datasheet view of a query. i.e. I want to take a value in 'Column A' and subtract the value in 'Column B' to create a value in 'Column C'?
View 2 Replies
View Related
Nov 20, 2014
I have a form, where one field is a combo box
The combo box is two columns linked to at table,
task and sla
You pick the task, and it displays the task
What i need is, another field, to equal the SLA part of that task.
View 5 Replies
View Related