Hi all,
I'm hoping for some assistance to help me build a function which calculates the average cost price (ACP) of our stocked products. I have had a look online to see if anything already exists but couldn't find anything suitable. I have attached 3 examples taken from an Excel workbook to help explain what I require. I'll breakdown what the columns are and how they relate to my database:
I hope to use this function in a query so when it is run it shows the item names with the current ACP value for each. It is also desirable to find the ACP as per a selected date to see historical prices.
I really appreciate any help you can provide.
Chris
I'm hoping for some assistance to help me build a function which calculates the average cost price (ACP) of our stocked products. I have had a look online to see if anything already exists but couldn't find anything suitable. I have attached 3 examples taken from an Excel workbook to help explain what I require. I'll breakdown what the columns are and how they relate to my database:
- Stock ID is the item code and is entered into the Product_Code field in the Purchase_Orders_Items table (purchase) and Customer_Order_Items table (sale).
- Movement is the transaction of the item, whether through a purchase order or sales order. Purchase order movements are entered into the Quantity_Delivered field in the Purchase_Orders_Deliveries table (linked to the Purchase_Orders_Items table where the Product_Code is entered). Sales orders are entered into the Order_Quantity field in the Customer_Order_Items table.
- Price per item for purchases are entered into the Product_Price field in the Purchase_Orders_Items table. Price per item for sales is taken from the ACP of the previous purchase of that item.
- Value is calculated from Movement x Price per item.
- Inventory is a running sum of all transactions (+ for purchases and - for sales).
- Total stock value is a running sum of the Value column.
- ACP is calculated from Total stock value divided by Inventory.
I hope to use this function in a query so when it is run it shows the item names with the current ACP value for each. It is also desirable to find the ACP as per a selected date to see historical prices.
I really appreciate any help you can provide.
Chris
Attachments
Last edited: