Results 1 to 4 of 4
  1. #1
    deluga.69 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    6

    Query To Sum Daily Sales Figures By Weekend and Weekdays

    I'm tracking box office grosses by movie, by date. I need a query that will sum these grosses by weekend (Fri/Sat/Sun) and Weekdays (Mon/Tue/Wed/Thu). I do have a separate table with the start and end dates for all weekend and weekday ranges going back to 2009.



    I am so new to Access I don't know anything and I'm sure this is a simple thing. Please help!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,631
    This is an aggregate GROUP BY (Totals) query. Use the query builder to help design. Access Help has more guidelines.

    Do you want data aggregated to 2 values: Mon-Thu and Fri-Sun? Will need to use functions for manipulating date/time values.

    A basic SQL statement for producing the 2 values:

    SELECT Sum(IIf(Weekday([DateField],2)>4, [Receipts], 0)) AS Weekend, Sum(IIf(Weekday([DateField],2)<5,[Receipts], 0)) AS Weekday FROM tablename;

    Add WHERE and/or GROUP BY clauses as needed. Such as:

    SELECT Year([DateField]) AS Yr, Sum(IIf(Weekday([DateField],2)>4, [Receipts], 0)) AS Weekend, Sum(IIf(Weekday([DateField],2)<5,[Receipts], 0)) AS Weekday FROM tablename GROUP BY Year([Datefield]);

    The only real issue is if change of year breaks one of the periods. If the period must be kept intact, which year should it fall in?
    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
    deluga.69 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    6
    Thanks June! I will try this when I get home tonight.

  4. #4
    deluga.69 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    6
    I used your SQL statement last night and it worked. Thanks so much for the help. Now I need to figure out exactly what it's doing/saying so I can use it on other queries.

    Thanks again!

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

Similar Threads

  1. weekdays versus weekend
    By webisti in forum Access
    Replies: 6
    Last Post: 09-10-2013, 02:27 AM
  2. Replies: 0
    Last Post: 12-13-2012, 03:18 AM
  3. Query to extract maximum figures for each date
    By vijanand1279 in forum Queries
    Replies: 2
    Last Post: 11-03-2011, 10:41 PM
  4. Daily Sales Report
    By bayswatergirl in forum Reports
    Replies: 1
    Last Post: 06-02-2011, 12:27 PM
  5. Query Help (Weekdays)
    By mattw in forum Queries
    Replies: 10
    Last Post: 10-19-2010, 12:11 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