Results 1 to 5 of 5
  1. #1
    bradleyg is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    12

    Sum Total By Year Help

    I have two columns, in one column the date (its by month and its for the last 4 years) and the second column is the sales for that month



    DATE TOTAL SALES
    Jan 2010 $1.00
    feb 2010 $2.00
    march 2010 $3.00
    Jan 2011 $3.35
    Feb 2011 $2.20
    and so on....

    I would like to run a query that will sum the sales by the year
    2010 $20.00
    2011 $22.00
    2012 $23.50
    and so on

    I think I need to do some sort of Dsum but really am lost.
    the names of the columns are "Date" and "Total Sales"

    Thanks!

    Brad

    any help will do

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What data type is [Date] field - text with month and year only?

    Date is a reserved word. Should not use reserved words as names. Also, advise not to use spaces and special characters/punctuation (underscore is exception), nor all caps in naming convention. Better would be Total_Sales or TotalSales.
    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
    bradleyg is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    12
    The date is a short date (and I will change the name. and total sales is currency and I will also change it to total_sales.

    t

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    So it is a date/time field with format setting of Short Date?

    SELECT Year([Date]) AS Yr, Sum([Total_Sales]) AS SumSales FROM tablename GROUP BY Year([Date]);

    Use the query builder and select Totals from the ribbon design tab.

    If you want to display detail records as well as aggregate data, build a report using Grouping & Sorting features with summary calcs in footers.
    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
    bradleyg is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    12
    thank you!

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

Similar Threads

  1. Replies: 3
    Last Post: 01-18-2015, 06:05 PM
  2. Replies: 2
    Last Post: 04-25-2014, 11:33 PM
  3. Dsum data between to dates for this year and last year
    By sdel_nevo in forum Programming
    Replies: 1
    Last Post: 06-13-2013, 06:48 AM
  4. Replies: 4
    Last Post: 01-09-2013, 11:16 AM
  5. Replies: 4
    Last Post: 01-10-2012, 06:26 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