Results 1 to 4 of 4
  1. #1
    lzuke is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2012
    Posts
    7

    Calculate periodic totals from running total

    Raw beginner here.

    At our office we have a door counter that counts customers as they enter AND leave the building. (so it counts them twice)
    The door counter ONLY provides a running total. It never resets. (I have no control over this)

    Every morning before we open, our department has to record the number from the door counter, which is basically the running grand total customers as of the End of Day yesterday and then we calculate the total number of customers that came in by comparing the door counts from one day to the next. We currently do this easily in Excel, but we are creating a very simple database for various statistics and want to include this statistic in with the others. The basic formula is:

    ([EOD Door Count] - [Previous EOD Count]) / 2 = Total Customers for the day (we divide by 2 because counter counts customers twice)

    In Access, I want to have a DAILY CUSTOMERS table in which we only input the EOD Door Count and then Access will store that number as well as a calculated Daily Total Customers for each day. Each record would include DATE / EOD DOOR COUNT / DAILY TOTAL CUST

    I don't know how to tell Access to refer to the PREVIOUS EOD door count in order to calculate the customer total.



    Example:

    Friday morning the door counter says 564,388 (previous to that it read 564,188)
    564,388 - 564,188 = 200 customers/2 = 100 customers came in on Thursday.

    Monday morning the door counter says 564,488
    564,488 - 564,388 = 100 customers/2 = 50 customers came in Friday.

    (Note: We don't do this EVERY day (when we're closed), so it just needs to refer to the previous door count from the last entry in order to make the calculation.)

  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,640
    Normally you wouldn't store the total, just calculate it on the fly. One way:

    http://allenbrowne.com/subquery-01.html#AnotherRecord
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    lzuke is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2012
    Posts
    7
    Thank you, Paul. The meter reader scenario seems to be very similar. I'll try working with that.

    I did consider whether I really needed the calculation in the table, but thought I'd be prepared to have it. The reason I decided to calculate it there is because I wanted staff to see right away how many people came in the day before, just so they know, and also as a safeguard in case they typed in the big number incorrectly. "Oops, no way we had 4230 customers yesterday. Better double check that." Right or wrong, that was my thinking anyway.

  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,640
    You can save it if you want, but if somebody goes back and edits a reading for last month, every saved value since then needs to be fixed.
    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. Looping to Calculate Running GPA
    By tonere in forum Programming
    Replies: 12
    Last Post: 03-15-2012, 07:25 AM
  2. Sub Total and Overall Totals in a Report
    By StevenCV in forum Reports
    Replies: 3
    Last Post: 02-27-2012, 08:09 AM
  3. How to Calculate this Grand Total
    By TWD in forum Reports
    Replies: 2
    Last Post: 01-13-2012, 11:36 AM
  4. Create Running Totals
    By dascooper in forum Access
    Replies: 9
    Last Post: 04-05-2011, 09:22 PM
  5. Replies: 1
    Last Post: 12-12-2010, 05:03 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