Results 1 to 6 of 6
  1. #1
    MattLibo is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    3

    How to Aggregate Totals by Date?

    Hello,

    I'm new to Access, and my first 'at home' project is to create a simple database to manage my finances. I'm looking to aggregate my account balance by date, in other words, what is the total amount in my 'account' from my first entry, to each respective date. I've tried using a query that Sums [transaction amount] and Groups By [Date1], but the result is just a total of transaction for each respective date, not an aggregate total from the starting date to each date.

    Would anyone know of a method of obtaining running totals by date?

    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    to sum , you cannot put TRANSDATE in the query. As you see it presents in the result.
    uncheck the SHOW button, so transDate only exists in the WHERE clause.

    select Sum(amt) from table where transDate between startdate and enddate

  3. #3
    MattLibo is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    3
    Hi ranman256,

    When I did that I only received the overall total in my account for the current date. What I need is to see the total in my account by day. Are you suggesting running X amount of queries, where X is the number of days since I started recording my transactions, and create a separate query each day?

    Thanks!
    Matt

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Something like this?
    Code:
    SELECT a.TransDate, a.TransIn, a.TransOut, (SELECT 100+Sum(b.TransIn) - Sum(b.TransOut) AS SumOfTrans
    FROM Table1 as b
    WHERE (((b.TransDate)<a.TransDate))) AS StartBal
    FROM Table1 as a;
    Or

    Code:
    SELECT a.TransDate, a.TransIn, a.TransOut, (SELECT 100+Sum(b.TransIn) - Sum(b.TransOut) AS SumOfTrans
    FROM Table1 as b
    WHERE (((b.TransDate)<=a.TransDate))) AS EndBal
    FROM Table1 as a;

  5. #5
    MattLibo is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    3
    Hi aytee111,

    I tried using both of those codes but the query keeps asking me for 'transin' and 'transout'. I also don't have a variable called 'Transdate'. The two variables I am using are [Date1] = Date and [Transaction Amount] = cost of transaction.

    Matt

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Yes, this was my testing names. Change all names to match your setup.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-05-2015, 01:34 PM
  2. Replies: 6
    Last Post: 02-28-2013, 05:38 PM
  3. Replies: 8
    Last Post: 09-27-2012, 11:25 AM
  4. Replies: 5
    Last Post: 12-06-2011, 11:18 AM
  5. Replies: 0
    Last Post: 06-07-2007, 02:33 PM

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