Results 1 to 6 of 6
  1. #1
    ghodgkins is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2015
    Posts
    9

    How to calculate differences

    I have about six categories that I rate various items against. I created a summary report and query that allows me to get the average of each category for the past two years. I was wondering if there's a way to get a calculation that would show the difference in averages, year over year?

    This is what I'm hoping to see:



    Avg of A Avg of B Avg of C Avg of D Avg of E Avg of F
    2014 1.75 2.00 1.50 3.00 2.75 2.50
    2015 2.00 1.75 1.50 2.25 2.25 3.00
    0.25 -0.25 0.00 -0.75 0.50 0.50

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    You could make a query off this query (above)
    Your query would need pull data to the same record to get: (2014Avg), (2015Avg), (2014Avg)- (2015Avg) as Diff

  3. #3
    ghodgkins is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2015
    Posts
    9
    Sorry... Not quite sure what you mean...

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    That requires getting value from another record in same table. One way is with nested subquery. Review: http://allenbrowne.com/subquery-01.html#AnotherRecord
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    make query Q2014 that avg only 2014
    make query Q2013 that avs only 2013
    then Q3 =
    SELECT [2013].ClientID, [2014].Avg2014, [2013].Avg2013, [Avg2013]-[Avg2014] AS Diff
    FROM 2013 INNER JOIN 2014 ON [2013].ClientID = [2014].ClientID;

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    And another method as suggested by ranman. However, it assumes the same clients will be in both years. If this is not the case, then join both queries to a master dataset of clients.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calculating Multiple Differences
    By dr4ke1990 in forum Queries
    Replies: 58
    Last Post: 01-02-2014, 12:34 PM
  2. Replies: 8
    Last Post: 03-19-2013, 07:55 AM
  3. Compare and show differences ...
    By raghuprabhu in forum Queries
    Replies: 5
    Last Post: 05-18-2012, 06:05 PM
  4. Replies: 1
    Last Post: 09-07-2011, 02:42 AM
  5. Compare tables and tell me differences
    By cowboy in forum Programming
    Replies: 2
    Last Post: 08-11-2010, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums