Results 1 to 4 of 4
  1. #1
    DavidQMP is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2016
    Posts
    8

    Averaging and Aggregate functions

    Hi,



    I'm trying to average 5 queries, however when I use a simple avg(query1+query2+query3) etc i get an error message regarding aggregates. I would use a simple /3 at the end instead however sometimes there is not a value in one of the queries, so it doesn't give the correct result. It there a simple formula to ignore empty values - obviously not NZ because that would 0 them.

    Could anyone help?

    Thanks

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Tell us about the 5 queries, or show us some SQL.

  3. #3
    DavidQMP is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2016
    Posts
    8
    So query 1 groups the type of property to give an average value, i.e.

    detached 100k
    semi-detached 90k

    i've then linked this back to another query using this property type.

    So i have a unique reference number that shows what the average value of a detached house is.

    The rest of the queries work in a similar way and are all linked back like this, adding them together and dividing by 5 works in the main query. But not if one of my sub queries has a null value in it, because it artificially lowers the averaged result, when i want to discount null values.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    In your query(ies) you want to exclude NULL values..

    Code:
    where  NOT  yourFieldValue  IS NULL
    (should work in the query SQL criteria)

    Show us some SQL and identify the field(s) that may be NULL

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

Similar Threads

  1. Replies: 4
    Last Post: 12-23-2014, 06:06 PM
  2. Replies: 8
    Last Post: 03-26-2014, 02:23 PM
  3. Including aggregate functions in a query
    By frind in forum Queries
    Replies: 2
    Last Post: 04-19-2013, 11:50 AM
  4. aggregate functions
    By gsrikanth in forum Access
    Replies: 3
    Last Post: 07-10-2012, 03:56 PM
  5. Replies: 5
    Last Post: 02-23-2012, 05:22 PM

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