With the following examples we want to demonstrate the practicality and versatility of table functions related with various addition operations.
These examples may also provide our readers with a general idea about the logic of table functions included in our .net libraries finaquant® protos (non-commercial) and finaquant® calcs (commercial).
Let's begin with the simplest case.
What if you want to add a scalar not to all key figures, but only to a selected one?
Note that the resultant (output) key figure is also the input key figure in this example, namely costs_other. What if you want to see the result of the addition in another key figure?
Note that the new key figure costs_total which is added into the table must already be defined in meta data. Otherwise the table function above will return an error.
So far, we were adding only a single scalar number to tables. What if you want to add key figures of a table to corresponding key figures of another table?
Note that the adjustment table (second table in addition) need not have all the key figures of the cost table. The only condition for this table function is, first table must contain all the fields of second table.
The tables to be added could have any number of attributes and key figures; the code and parameters of the table function wouldn't change. Matching the attribute combinations of two tables before applying any algebraic operations is the built-in logic in most of the table functions.
In our last example we use match-all values (joker values) in the second table (addend) for attributes. Additive cost adjustments are given either per category (like sports), or per brand (like Toyota), or per category and brand (like Luxury/Honda).
How about other algebraic operations like multiplication, division and subtraction?
Be assured; the general logic is just the same. There is a set of table functions for each algebraic operation, and more.
This entry was posted in Calculation engine and tagged table functions. Bookmark the permalink.