Setting up derived attributes
Derived attributes are attributes whose data is "derived" from other attributes. For example, lets assume that the OrderDetails entity contains the attributes Quantity and UnitPrice but does not contain the attribute TotalPrice. To gain better insight into the annual sales figures, the organization would like to add the TotalPrice attribute to the model and derive its data from the Quantity and UnitPrice attributes.
Assuming that the Northwind sample database is the model’s source, this could easily be done as follows:
- Add the TotalPrice attribute domain to the model as described in Managing attributes.
- After finalizing the model, create the data warehouse tables as described in Creating the data warehouse tables.
-
Click the OrderDetails mapping as described in Editing column mappings.
Note that the TotalPrice attribute has no mapping as it was added after the Northwind source was discovered:
-
Open the Expression Builder by clicking the fx icon to the right of the TotalPrice column name. Then, in the Expression Builder, add the Quantity and UnitPrice columns to create the following expression:
Quantity*UnitPrice
For more information on creating expressions, see Creating expressions.
-
Click OK to close the Expression Builder and save the expression.
The Quantity and UnitPrice landing zone columns are now mapped to the TotalPrice data warehouse column. Notice that the mapping lines are gray, indicating that the mapping is the result of an expression.
Hovering the mouse cursor over the gray lines highlights the derived column (TotalPrice) and the columns from which its data is derived (Quantity and UnitPrice).