How it works
The trick is that even though the source cube (Production) does not have a Month dimension, the DB function scans the referenced cube for dimension elements whose names match those of elements in the equivalently ordered dimension in the target cube.
In this case, the DB function looks for elements in the Month dimension that match element names in the Date dimension.
- As always, the TM1® server determines if the value
requested matches any rule statement area
definitions.
['Price/Kg - USD']=['Price/Kg - LC']\DB('CurrencyExchangeRate', DB('Currency',!market,'MarketCurrency'),!date);
- The request does match the area definition of the above rule statement, so TM1 begins to evaluate the formula portion of the statement.
- TM1 retrieves the value of Price/Kg - LC, keeping all other dimension elements constant (Trout, Karachi, Jun -16.) In the Purchase cube, this value is 76.64.
- TM1 evaluates the nested DB functions
DB('CurrencyExchangeRate',DB('Currency',!market,'MarketCurrency'),!date).
- The first argument to the outer DB function tells TM1 to look in the CurrencyExchangeRate cube.
- The second argument to the outer function, which must resolve to a valid element of the Currency
dimension, is another DB
function:
DB('Currency',!market,'MarketCurrency')
This nested DB function returns the value from the Currency cube identified by the market for the value being requested (!market) and the element MarketCurrency. In this case, the TM1 server is processing a request for a value in the Karachi market, so the function returns the string 'Rupee'.
Rupee is a valid element of the Currency dimension.
Rupee is the second argument to the outer DB function.
- The third argument to the outer DB function is
!date
, which evaluates to Jun -16, the date of the requested value.
- The outer DB function evaluates to DB('CurrencyExchangeRate','Karachi','Jun-16'). TM1 retrieves the value for Karachi and Jun -16 from the MarketExchange cube.
- The formula portion of the rule statement evaluates to 76.64\57.4801.
-
TM1 calculates the value of Price/Kg - USD for Trout in
Karachi on June 16 to be $1.33, as shown in the following figure.