4 Replies Latest reply on Feb 25, 2013 11:41 AM by robby@brays.net

# Calculation For an updated Cost

Hello. I am trying to get build a calculation for a record that will look at the most current lineitem cost, in a portal that is related to that record.

What I have built is a Product table with all my current Products. I have then built a line item table related to the product table. The line item table is a date, name, quanity, and Cost table that is related to each product. Now when I reorder the Raw Material needed to build the product, it will update the product cost with the most current Lineitem's cost, updating the cost of the product.

• ###### 1. Re: Calculation For an updated Cost

Hi Rob

If you set the relationship with the costs table to be sorted by date, then you can use Last ( Products_Costs::Cost ) to get what you want.

Regards

Ibrahim

1 of 1 people found this helpful
• ###### 2. Re: Calculation For an updated Cost

Ok Cool. Thanks for the info, let me give that a whirl and see what happens.

1 of 1 people found this helpful
• ###### 3. Re: Calculation For an updated Cost

Bingo !  That did it Ibrahim.  Thanks for the info!

• ###### 4. Re: Calculation For an updated Cost

So here is what I have now encountered.  The Raw material table, continues to update each record now with the newest lineitem entry as you showed me how to do.  This works perfect.  Now, I am trying to update a Products table, which has different raw materials in each record ex. Channel, Tube, Screws, ect.  with the Raw material cost that we have just now got working but . . . when I try to use the Raw material Cost field it says that it cannot use a non indexed field.

So if you are with me here, I have a products table, that each record in it, is a PRODUCT and each PRODUCT  uses 2-3 Raw Materials to assemble that product.

The Raw material costs that I want to plug into this Products table, to calucate a PRODCUT cost, are all the raw material costs for each Product, which are being updated in the Raw material table via the line items entries for the newest RAW Material Costs  that I just used your formula to keep the raw material cost current.

Hope this all makes sense.