Results 1 to 2 of 2
  1. #1
    randolphoralph is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Dec 2008
    Posts
    58

    Query to Average on Grouped Fields

    I am trying to group by Names and get the Avgerage Days greater than 0 for each group.



    Table Name: Test
    Field1: Names
    Field2: Days

    Here is what I have so far and the problem I have is that the average is for all the records and not grouping by name. The second issue I have is that the Average is including negative numbers and not just the numbers greater than zero.

    Code:
    SELECT test.Names, Avg(Days)>0 AS AvgDays
    FROM test
    GROUP BY test.Names;

  2. #2
    randolphoralph is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Dec 2008
    Posts
    58
    I found the solution. After playing with the query some more I found the solution.

    Code:
     
    SELECT test.Names, Avg(Days) AS AvgDays
    FROM test
    WHERE test.Days>0
    GROUP BY test.Names;

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

Similar Threads

  1. Calculate average in a query
    By srbooth in forum Queries
    Replies: 1
    Last Post: 02-20-2010, 09:41 AM
  2. Grouped Report Missing Data
    By travismd in forum Reports
    Replies: 1
    Last Post: 11-30-2009, 11:08 AM
  3. Grouped Tables
    By tmcrouse in forum Queries
    Replies: 0
    Last Post: 09-24-2009, 07:10 AM
  4. Rounding the Average in a Query
    By jakelufkin in forum Access
    Replies: 3
    Last Post: 06-19-2009, 08:31 PM
  5. Select query for Exponential Moving Average.
    By krishna79 in forum Queries
    Replies: 0
    Last Post: 01-22-2009, 05:52 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