Results 1 to 2 of 2
  1. #1
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616

    Query to use previous row's data ?

    I am designing database for an inventory. I have tables holding details for items Purchased and Issued. All the items purchased and issued are based on unique "Item Code". The items are issued to various equipments and the cost of the issued item is booked for that particular equipment. I am finding problems to calculate the weighted average using query. I can calculate through VBA using recordset but it takes more time to calculate. I think a stored query will perform faster. Am I right ?



    An example is mentioned below :
    Purchase Details :
    Purchase date Item code Qty Unit Price
    June 1 111 5 15
    June 8 111 3 20
    June 12 111 6 25

    Issue details :
    Date Op.Bal QtyIssued Wtd.Avg.(per unit)
    June 5 5 2 15
    June 10 3 3 [(3*15)*(3*20)/(3+3)]=17.5
    June 15 3 2 [(3*17.5)+(6*25)/(3+6)]=22.5







    The weighted average(unit cost) is calculated as -
    [(Old Qty*Old Weighted Avg)+(New Qty*New Price)] / [Old Qty + New Qty]
    It is basically total inventory cost of that item divided by number of items in stock on issue date. Hence, the weighted average will change after very new purchase.

    Can this be achieved through a query ? I am stuck in the last column above. Any pointers/samples are appreciated.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

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

Similar Threads

  1. Displaying Previous Week's Data in Subreport
    By mejia.j88 in forum Reports
    Replies: 3
    Last Post: 06-30-2012, 01:07 PM
  2. Replies: 1
    Last Post: 12-21-2011, 02:11 PM
  3. Replies: 4
    Last Post: 09-09-2011, 10:00 PM
  4. DSum where data is from previous week only
    By doodles in forum Access
    Replies: 3
    Last Post: 01-31-2011, 08:35 AM
  5. Add data from previous record if blank
    By mbc321 in forum Queries
    Replies: 1
    Last Post: 08-08-2009, 05:15 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