Stocks and Flows
You might think that such calculations - which are easiest to describe in a step-by-step, ''procedural" manner - cannot be expressed in a declarative language. In fact, they can be expressed economically and calculated efficiently using rules, and there are many large TM1 applications that perform such functions.
In earlier sections, you saw how Fishcakes International moves information on purchases into the Inventory cube, and how information on production from the Production cube is allocated in the FishRequired cube.
In this section, we use that information to calculate the daily cost of fishcake production as determined by the cost of each separately priced batch of fish coming from inventory. Remember that fish price varies from day to day and from market to market.
To do this, you take information from the FishRequired cube to calculate the daily requirements for each fish type. You then use information from the Inventory cube to determine the available fish in stock. Finally, a new cube called Depletion calculates how inventory is used to satisfy the daily requirements.