excel - How to build an inventory from transactions in access -
i trying determine cost of goods each , date in inventory including interest payments based on transactions in system. receive information regarding transactions ms sql server , limited ms access , excel analyze data.
i have built query gives me following fields:
goodscode | transactiondate | transactionquantity | transactionprice | transactiontype
and further input have
interestrate
the output looking is:
goodscode | transactiondate | inventorybalance | unitcost
i able reproduce problem single in excel adding variables took inputs previous , current row in following way (with t being current row , t-1 previous row):
inventorychange(t) = if(transactiontype = "sale" or "salereturn"): + transactionquantity(t) else: - transactionquantity(t) inventorybalance(t) = inventorybalance(t-1) + inventorychange(t) dayspassed(t) = transactiondate(t-1) - transactiondate(t) inventorycost(t) = inventoryvalue(t-1) * ((1+interestrate)^dayspassed(t) - 1) referenceprice(t) = if(transactiontype = "purchase" or "purchasereturn"): transactionprice(t) else: unitcost(t-1) * (1+interestrate)^dayspassed(t) inventoryvalue(t) = inventoryvalue(t-1) + inventorycost(t) + inventorychange(t) * referenceprice(t) unitcost(t) = inventoryvalue(t) / inventorybalance(t)
the result looking table operation takes place every can analyze individual goods in further queries or pivot tables. new access not know method use, i.e. necessary loop through every row perform operation? if so, best way this, in sql or in vba.
thanks in advance hints.
edit:
i've though bit solution , 1 way might make second query shifted 1 row operation (this how efficiently handle problem in matlab).
now problem remains how address rows goodscode switches. think sql let me iterate through every goodscode, access limited.
crosstab query in access might can you. think can't crosstab query in sql.
Comments
Post a Comment