Results 1 to 4 of 4
  1. #1
    Schon731 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    19

    Sum $$ by date


    Probably easy but I need to add all of the negative margin for each date. So basically I want the output to show one line for 3/1/2012 and a total of (3.32) and one line for 3/2/2012 to show (224.15) and on for each date in the table. Thanks in advance.

    Store Number TX-Date Filled Margin Total Due TX-Acq Cost
    102 3/1/2012 ($2.80) $28.98 $31.78
    102 3/1/2012 ($0.52) $17.26 $17.78
    102 3/2/2012 ($169.93) $19.00 $188.93
    102 3/2/2012 ($29.90) $31.71 $61.61
    102 3/2/2012 ($13.82) $3.98 $17.80
    102 3/2/2012 ($7.95) $139.21 $147.16
    102 3/2/2012 ($2.55) $35.55 $38.10

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Start a new query on that table and select the date and margin fields. Click on the Totals icon in the toolbar. Change Group By to Sum on the margin field and run the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Schon731 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    19
    Quote Originally Posted by pbaldy View Post
    Start a new query on that table and select the date and margin fields. Click on the Totals icon in the toolbar. Change Group By to Sum on the margin field and run the query.

    Ok its a little more complicated. The margin field has both positive and negative values and I only want the negative so I had <0 in the Criteria. With that the totals doesnt work, with it blank it does but it totals everything so does that mean I need to first create a query that pulls the negatives, then do the totals so I need 2 queries to accomplish this or can I do it in one?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Try

    SELECT DateField, Sum(IIf(Margin < 0, Margin, 0)) AS TotalNegMargin
    FROM TableName
    GROUP BY DateField
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 12
    Last Post: 04-26-2012, 04:01 AM
  2. Date Range Report with Multiple Date Fields
    By StevenCV in forum Reports
    Replies: 13
    Last Post: 02-29-2012, 08:29 AM
  3. Replies: 1
    Last Post: 12-12-2011, 06:32 AM
  4. Replies: 1
    Last Post: 12-07-2011, 01:02 PM
  5. Replies: 1
    Last Post: 07-07-2010, 04:22 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