Results 1 to 2 of 2
  1. #1
    WimDC is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    12

    "last" function in totals query

    Hello,

    I'm trying to build (a rather simple) totals-query, but the "last" function doesn't give me the right values.
    Suppose I have a database where the amount of products that were sold are stored per month. It's possible that some products are not sold in some months. (see the really dummy-database in attachment)

    Now, I want the LAST REAL VALUE (= amount) for each product, no matter what month :

    prod1 = 4
    prod2 = 3
    prod3 = 3

    How can I do that, because the LAST-function gives me
    prod1 = (empty)
    prod2 = 3
    prod3 = (empty)



    Thanks for helping!
    Attached Files Attached Files

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I cannot download your database from my location.

    What is "last" in relation to? A date field? If so, try "MAX" instead.

    Also, you may need to do this in a two-step process, one to find the "MAX" date for each product, and then a second to link back to the original data source to get the amount associated with that product and date.

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

Similar Threads

  1. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  2. Replies: 1
    Last Post: 08-23-2012, 08:32 AM
  3. Replies: 2
    Last Post: 11-04-2011, 02:45 AM
  4. Replies: 3
    Last Post: 04-10-2010, 10:22 AM
  5. Query Results "Count Totals"
    By tipopilotas in forum Queries
    Replies: 1
    Last Post: 03-26-2010, 10:36 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