Results 1 to 5 of 5
  1. #1
    jamesborne is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    13

    Finding the Median when in a grouped Query

    Dear Access Buddies,
    I have a table called 'Orders' with the following fields:


    -ID
    -Date
    -Customer

    I have created a query that Groups each customer and counts how many times each customer has made an order (from the orders table). Then I found the Min(date) and Max(date) for each customer. Next I subtituted the Min date from the max date. Finally, I divided the result by the count that I found at the beginning.

    All this hardwork gave me the average. The Query looks somthing like this:

    Customer
    Max Date
    Min Date
    (Max-Min)/Count [This is the average difference in time between the orders, for each customer)


    Now, the question is, how can I find the median because its far more reliable than the mean in this case?

    Thanks in advance,
    J. Borne

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Google: Access query median

    Here is one http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    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.

  3. #3
    jamesborne is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    13
    June 7, I tried googling that but all sources contained complicated code and considering my moderate level of programming, isn't feasible. But thanks anyway for contributing!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I think VBA code is the only option. That MSDN article is probably the best you will get.
    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
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. Median Calculations and Group By
    By jlandis in forum Queries
    Replies: 4
    Last Post: 02-22-2011, 11:15 PM
  2. Replies: 1
    Last Post: 10-24-2010, 07:42 PM
  3. Median value for multiple columns
    By MIS_Analist in forum Queries
    Replies: 2
    Last Post: 10-08-2010, 11:14 AM
  4. Query to Average on Grouped Fields
    By randolphoralph in forum Queries
    Replies: 1
    Last Post: 03-16-2010, 08:03 PM
  5. Finding Median in Query
    By randolphoralph in forum Queries
    Replies: 1
    Last Post: 02-19-2010, 11:18 AM

Tags for this Thread

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