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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MDX uses a multidimensional data model to enable navigation in multiple dimensions, levels, and up and down a<br />

hierarchy. With MDX, you can access pre-computed aggregates at specified positions (levels or members) in a<br />

hierarchy.<br />

Note: MDX is an open standard. However, <strong>SAP</strong> has developed extensions to MDX that are designed to<br />

enable faster and more efficient access to multidimensional data, for example, to serve specific <strong>SAP</strong><br />

<strong>HANA</strong> application requirements and to optimize the resultset for <strong>SAP</strong> <strong>HANA</strong> clients.<br />

MDX is implicitly a hierarchy-based paradigm. All members of all dimensions must belong to a hierarchy. Even if<br />

you do not explicitly create hierarchies in your <strong>SAP</strong> <strong>HANA</strong> data model, the <strong>SAP</strong> <strong>HANA</strong> modeler implicitly<br />

generates default hierarchies for each dimension. All identifiers that are used to uniquely identify hierarchies,<br />

levels and members in MDX statements (and metadata requests) embed the hierarchy name within the identifier.<br />

In <strong>SAP</strong> <strong>HANA</strong>, the standard use of MDX is to access <strong>SAP</strong> <strong>HANA</strong> models (for example, analytical and attribute<br />

views) that have been designed, validated and activated in the modeler in the <strong>SAP</strong> <strong>HANA</strong> studio. The studio<br />

provides a graphical design environment that enables detailed control over all aspects of the model and its<br />

language-context-sensitive runtime representation to users.<br />

MDX in <strong>SAP</strong> <strong>HANA</strong> uses a runtime cube model, which usually consists of an analytical (or calculation) view that<br />

represents data in which dimensions are modeled as attribute views. You can use the analytical view to specify<br />

whether a given attribute is intended for display purposes only or for aggregation. The key attributes of attribute<br />

views are linked to private attributes in an analytical view in order to connect the entities. One benefit of MDX in<br />

<strong>SAP</strong> <strong>HANA</strong> is the native support of hierarchies defined for attribute views.<br />

Note: MDX in <strong>SAP</strong> <strong>HANA</strong> includes native support of hierarchies defined for attribute views. <strong>SAP</strong> <strong>HANA</strong><br />

supports level-based and parent-child hierarchies and both types of hierarchies are accessible with MDX.<br />

<strong>SAP</strong> <strong>HANA</strong> supports the use of variables in MDX queries; the variables are a <strong>SAP</strong>-specific enhancement to<br />

standard MDX syntax. You can specify values for all mandatory variables that are defined in <strong>SAP</strong> <strong>HANA</strong> studio to<br />

various modeling entities. The following example illustrates how to declare <strong>SAP</strong> <strong>HANA</strong> variables and their values:<br />

MDX<br />

Select<br />

From [MINI_C1_VAR]<br />

Where [Measures].[M2_1_M3_CONV]<br />

<strong>SAP</strong> VARIABLES [VAR_VAT] including 10,<br />

[VAR_K2] including 112,<br />

[VAR_TARGET_CURRENCY] including 'EUR',<br />

14.3.3 MDX Functions<br />

MDX in <strong>SAP</strong> <strong>HANA</strong> supports a variety of standard MDX functions.<br />

Table 17: Supported MDX Functions<br />

Function Description<br />

Aggregate Returns a calculated value using the appropriate aggregate function, based on the<br />

aggregation type of the member.<br />

Ancestor Returns the ancestor of a member at a specified level or at a specific distance away<br />

in the hierarchy.<br />

Ancestors Returns a set of all ancestors of a member at a specified level or at a specific<br />

distance away in the hierarchy.<br />

Ascendants Returns the set of the ascendants of the member.<br />

366<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 />

Using Database Client Interfaces

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

Saved successfully!

Ooh no, something went wrong!