Results 1 to 5 of 5
  1. #1
    jasonman is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    8

    How to Benchmark The Best Month Sales

    Please help. The query below sums sales per month in the entire Table.

    SELECT Sum([GOLF SHOP OPERATIONS].CartFees) AS SumOfCartFees, Format([GOLF SHOP OPERATIONS].TheDate,"mm-yyyy") AS MonthYear
    FROM [GOLF SHOP OPERATIONS]
    GROUP BY Format([GOLF SHOP OPERATIONS].TheDate,"mm-yyyy");

    How can I adjust the query so only the "best" month in sales is returned.

    For example the query mentioned above returns these results:

    SumOfCartFees MonthYear
    $14,449.85 01-2010
    $12,809.68 02-2010


    $41,427.82 03-2010
    $56,632.40 04-2009
    $60,047.73 04-2010
    $59,614.77 05-2009
    $67,517.04 05-2010
    $65,264.06 06-2009
    $62,817.18 06-2010
    $75,238.79 07-2009
    $59,629.86 07-2010
    $63,801.46 08-2009
    $75,207.17 08-2010
    $58,586.41 09-2009
    $48,897.65 09-2010
    $49,762.43 10-2009
    $35,063.78 10-2010
    $39,276.54 11-2009
    $17,433.62 12-2009

    However, I ONLY want it to return.

    SumOfCartFees MonthYear
    $75,238.79 07-2009

    Anyone know how to do this? Thanks.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    try:
    Code:
    SELECT TOP 1 
    
    Sum([GOLF SHOP OPERATIONS].CartFees) AS SumOfCartFees, Format([GOLF SHOP
    
    OPERATIONS].TheDate,"mm-yyyy") AS MonthYear
    
    FROM [GOLF SHOP OPERATIONS]
    
    GROUP BY Format([GOLF SHOP OPERATIONS].TheDate,"mm-yyyy")
    
    ORDER BY Sum([GOLF SHOP OPERATIONS].CartFees) AS SumOfCartFees, Format([GOLF SHOP
    
    OPERATIONS].TheDate,"mm-yyyy") DESC;

  3. #3
    jasonman is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    8
    Thanks. I couldn't get the query you suggested to work without an error. But it led me to this one, which seems to work. Thanks for the help.

    SELECT TOP 1
    Sum([GOLF SHOP OPERATIONS].CartFees) AS SumOfCartFees, Format([GOLF SHOP OPERATIONS].TheDate,"mm-yyyy") AS MonthYear
    FROM [GOLF SHOP OPERATIONS]
    GROUP BY Format([GOLF SHOP OPERATIONS].TheDate,"mm-yyyy")
    ORDER BY Sum([GOLF SHOP OPERATIONS].CartFees) DESC;

    Which returns:

    SumOfCartFees MonthYear
    $75,238.79 07-2009

    Thanks again.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you ready to follow the link in my sig and mark this thread as Solved?

  5. #5
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    I did it Allen. I think it's safe now

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

Similar Threads

  1. How to group by month
    By okrobie in forum Queries
    Replies: 4
    Last Post: 06-09-2011, 04:41 AM
  2. client database for insurance sales
    By rublerv in forum Access
    Replies: 1
    Last Post: 03-25-2010, 08:00 AM
  3. need query to assign sales leads to reps??
    By RickM in forum Queries
    Replies: 0
    Last Post: 03-12-2009, 02:44 PM
  4. computing total sales per day using query
    By joms222 in forum Queries
    Replies: 0
    Last Post: 03-09-2009, 10:58 PM
  5. Point of Sales Application
    By chico_yallin in forum Access
    Replies: 1
    Last Post: 06-23-2007, 05:30 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