Allocating Costs in the FishRequired Cube
Now that you have calculated daily costs for each fish type, you can allocate these costs to the different types of fishcakes produced by Fishcakes International.
Costs for a given fish type need to be allocated to each type of fishcake that utilizes the fish. The allocation of costs is dependent upon the number of kilos of the fish used in the fishcakes on a given day.
For example, in the Inventory cube you can see that the total cost of trout used on April 30 is $8,585.39. This total encompasses all DaysOld batches.

This total cost needs to be broken down and allocated to individual fishcake types depending on the quantity of trout used in each fishcake on April 30. You can accomplish this with a statement in the rule for the FishRequired cube:
['Cost']=DB('Inventory',!fishtype,!date,'DaysOld Total','Cost
of Fish Used') * ['Qty Required - Kgs'] \ ['Total Fish Cake Types','Qty
Required - Kgs'];
This statement says that for any given fish type on any given date, the allocated cost of that fish for any given fishcake type is calculated by multiplying the total cost of fish used in the Inventory cube by the quantity of the fish required in the FishRequired cube. Then, divide that product by the total quantity of the fish required by all fishcake types. A bit later in this section you will see a full illustration of how this statement works.
You can now add the statement to the rules for the FishRequired cube.