Results 1 to 6 of 6

Subtract Daily values from each other

  1. #1
    MFS is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    234

    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 offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    13,111

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

  4. #4
    ridders52's Avatar
    ridders52 is offline Voodoo Is Practised
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    2,708
    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 (Mendip Data Systems), Website, email
    If this has helped, please click the star button and leave a comment

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

  6. #6
    ridders52's Avatar
    ridders52 is offline Voodoo Is Practised
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    2,708
    On behalf of us all, you're welcome.
    Colin (Mendip Data Systems), Website, email
    If this has helped, please click the star button and leave a comment

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