Results 1 to 5 of 5
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    find average of values in a totals query


    I am running a totals query that takes line items, combines them by filename and then sums a value. that may end up showing me 10 lines with a sum for each line. How can I add a column that will show me the average of those sums. Since I cant do a total at the bottom and I don't want to use a report i realize it will show the same value at the end of each row, if it is even possible

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you already have Q1 to get the 10 sums,
    then make Q2 that uses Q1 to get AVG.

  3. #3
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    I am not sure that gives me what I want.

    I would like

    file cust total avg
    file1 cust1 10 19.8
    file2 cust1 25 19.8
    file3 cust1 32 19.8
    file4 cust1 10 19.8
    file5 cust1 22 19.8
    file1 cust2 10 15
    file2 cust2 15 15
    file3 cust2 20 15
    file4 cust2 15 15

    I don't know if this is possible because I want the average for that customer over a period of time to show at the end of each row.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Maybe make query with 3 fields with GroupBy on cust column, Count on cust column(CountOfcust) and Sum on total column(SumOftotal). Then 3rd query using that query with Avg: SumOfTotal / CountOfcust. You could like this 3rd query back to the first one you posted by cust to combine both to add the avg. Probably better ways in code maybe using DCount an DSum to get the average.

  5. #5
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    good thought on the dcount. I will give that a try

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

Similar Threads

  1. Replies: 2
    Last Post: 01-25-2016, 10:25 AM
  2. Totals Query of MAX with Corresponding Values
    By aussie92 in forum Queries
    Replies: 1
    Last Post: 12-16-2014, 01:09 PM
  3. Replies: 3
    Last Post: 02-24-2014, 02:19 PM
  4. Can I count Null values in a totals query?
    By bgephart in forum Queries
    Replies: 2
    Last Post: 08-29-2012, 10:13 AM
  5. Query to show AVERAGE of all values in a field
    By taimysho0 in forum Queries
    Replies: 9
    Last Post: 01-09-2012, 11:18 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