28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Note: In the Logical Join, you can create a temporal join between the date field of the fact<br />

table to an interval (to and from) field of the attribute view. The temporal join has to start from<br />

the fact table such that the single column must be in the fact table and, the to and from<br />

columns must be in the table that is directly joined to the fact table. The join type must be a<br />

referential join. The supported data types are timestamp, date, and integer.<br />

Restriction: While creating joins you must ensure that a table does not appear twice in any join path (in<br />

particular a self join is not supported). A join path is the set of joins that links the fact table to other<br />

tables.<br />

While creating joins between analytic view and attribute view the same table cannot be used both in<br />

the join path of analytic view and attribute view. Also, in a join path of analytic view and attribute view,<br />

the table of the attribute view which is linked to the fact table should not have an alias table.<br />

3. Optional Step: Create Calculated Column<br />

a) In the Output of Logical Join panel, right-click Calculated Columns.<br />

b) In the context menu, choose New.<br />

c) Enter a name and description (label) for the calculated column.<br />

d) Select a data type, and enter the length and scale for the calculated column.<br />

e) Select the Column Type to determine whether it is a calculated attribute or a calculated measure.<br />

f) If you select Calculate Before Aggregation, select the aggregation type.<br />

Note: If you select Calculate Before Aggregation, the calculation happens as per the expression<br />

specified and then the results are aggregated as SUM, MIN, MAX or COUNT. If Calculate Before<br />

Aggregation is not selected, the data is not aggregated but it gets calculated as per calculation<br />

expression (formula), and the aggregation is shown as FORMULA. If the aggregation is not set,<br />

then it will be considered as an attribute.<br />

g) In the Expression Editor enter the expression. For example, you can write a formula:<br />

if("PRODUCT" = 'ABC, "DISCOUNT" * 0.10, "DISCOUNT") which is equivalent to, if attribute PRODUCT<br />

equals the string ‘ABC’ then DISCOUNT equals to DISCOUNT multiplied by 0.10 should be returned.<br />

Otherwise the original value of attribute DISCOUNT should be used.<br />

Note: The expression can also be assembled by dragging and dropping the expression elements<br />

from the menus below the editor window.<br />

h) If you want to associate the calculated column with currency and unit of measuring quantity, select the<br />

Advanced tab page and select the required Type.<br />

i) Choose OK.<br />

Remember: Calculated Columns can be created only at the Logical Join level and not at the Data<br />

Foundation level.<br />

Note: The aggregation type for calculated columns is only taken into account, if they are calculated<br />

before aggregation<br />

4. Optional Step: Create Restricted Columns<br />

112<br />

You can create restricted columns if you want to filter the value for an output field based on the user-defined<br />

rules. For example, you can choose to restrict the value for the Revenue column only for Region = APJ, and<br />

Year = 2012.<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved.<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Setting Up the Analytic Model

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!