Databases Reference
In-Depth Information
In the Output pane of the analytic view, you'll see a node named Calculated Attributes , as we
can see here:
Right-click on the Calculated Attributes node, then select New from the menu. You'll see the
Calculated Attribute dialog window, which asks for a name and a description for the attribute
(we'll use NEXT_YEAR as both name and description). The data type for the calculated attribute
is VARCHAR with a length of 4 —this is the same type as the original ORDER_YEAR field.
Next, we need to enter the formula used to calculate the attribute. If you've used formulas in
Excel, then this will seem familiar; it works the same way.
Basically, what we need to do is to take the value of the ORDER_YEAR column, and add 1 .
However, we can't work on the ORDER_YEAR column directly; as we've just seen, its data type
is VARCHAR , which is a string of characters.
In order to do mathematical calculations on the value in the ORDER_YEAR column, we must
first obtain a numeric representation of the value. Next, we'll add 1 to this value, and then
retransform the result back into a string.
This can be summarized in the following points:
Ê Obtain a numeric representation of the contents of the ORDER_YEAR column
Ê Add 1
Ê Transform the result of the calculation back into a string representation
Search WWH ::




Custom Search