Results 1 to 6 of 6
  1. #1
    MFS is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235

    Subtract Daily values from each other

    Good morning,


    I'm thinking my issue is probably fairly easy, but I'm getting nowhere and once I get the support from all of you I will probably be somewhat embarrassed for asking.

    My table has three fields. (Data from a boiler.)
    Date_1
    Totalized_Steam
    Totalized_Gas

    Each evening, at midnight, this data is sent to the database via a plant floor PLC.
    Totalized Steam and Gas is just that, these numbers increase daily from the beginning of time.

    What I am needing is . . .
    Lets say yesterday at midnight my Totalized_Steam value equals 1000
    Tonight at midnight it may read 1200
    I would like a column in my query that shows I've produced 200 lbs of steam over the past 24 hours. By subtracting Totalized_Steam from tonight's midnight entry from yesterday's

    Of course I would need to show this value for each day, (I will be building a rolling 30 day report.)

    Any help would be greatly appreciated.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    make 3 queries:
    Q1 today
    Q2 yesterday
    Q3, the difference

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    And a third solution - one query with 2 copies of the table - for a very similar example, see http://www.mendipdatasystems.co.uk/g...lue/4594484854
    Choose whichever method you prefer
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    MFS is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235
    Thank You everyone,
    I went with ridders52 solution and it works perfectly.

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    On behalf of us all, you're welcome.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. add or subtract
    By MdHaziq in forum Queries
    Replies: 2
    Last Post: 10-05-2017, 10:23 PM
  2. Subtract Groups
    By davetedwards in forum Reports
    Replies: 4
    Last Post: 12-30-2013, 10:56 AM
  3. Subtract from Previous Row
    By lambo102 in forum Queries
    Replies: 1
    Last Post: 08-06-2011, 09:39 AM
  4. How to do subtract in Query
    By NoOoN in forum Queries
    Replies: 6
    Last Post: 04-07-2011, 01:15 PM
  5. Subtract from inventory
    By NISMOJim in forum Access
    Replies: 5
    Last Post: 01-30-2011, 01:09 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