How to Calculate Percentage of Change

bb26

New member
Local time
Today, 12:43
Joined
Mar 27, 2013
Messages
1
I have this table

Year AvgOfValue
2005 109.061690295772
2009 106.801581389669

I have to calculate the percentage of change of the values. I have very basic knowledge. How can I make a query to calculate the percentage of change?

Any help is greatly appreciated!!
 
If you are trying to calculate the percentage of change of the values, then you will need to go back to the original values in order to calculate this, trying to calculate this from a calculated average can give some misleading conclusions unless you actually want to measure the change of the average. If this is the case then this can't be done in a simple single step process as you're calculation will be based on comparing records as opposed to comparing values in different fields (which can be done easily).
I'd suggest making a temp table that will have, based on your example above, the following fields,
a PK field that links the 2 records above,
year2005value,
year2009value,
percChange

Step 1,
use an append query to add records putting values into the PK field and the year2005value with the 2005 values, criteria where year = 2005
Step 2,
use an update query to update the year2009value with the 2009 values, criteria where year = 2009, inner join from the temp table to the original source ON PK field

Once you have these values you can run
Step 3, update the percChange field = (year2009value - year2005value)/year2005value
this will calculate the percentage change giving as a minus figure if the 2009 figure is less than the 2005 figure

This whole approach could also be done in VBA using recordsets, but the above would be the visual approach

David
 
If you have an autonumber field in your table/query with consecutive numbers then you may try the following sample SQL to create a Query with appropriate changes:

Code:
SELECT Table1.id, Table1.AvgOfValue, (DLookUp("AvgOfValue","table1","id = " & [id]+1)-[AvgOfValue])/[AvgOfValue]*100 AS pcnt
FROM Table1;
 

Users who are viewing this thread

Back
Top Bottom