Showing posts with label Analytic View. Show all posts
Showing posts with label Analytic View. Show all posts

Thursday 28 September 2017

SAP HANA: Level Hierarchy

What is Hierarchy?

Hierarchies help business to analyze their data in a tree structure through different levels/layers with drill-down capability. Each hierarchy comprises a set of levels having many-to-one relationships between each other and collectively these levels make up the hierarchical structure.
For example, a time hierarchy comprises of levels such as Fiscal Year, Fiscal Quarter, Fiscal Month, and so on.
We can create two types of hierarchies in SAP HANA, they are
1.      Level Hierarchy
2.      Parent-Child Hierarchy

Level Hierarchy:

In level hierarchies, each level represents a position in the hierarchy. For example, a time dimension can have a hierarchy that represents data at the month, quarter, and year levels.

Context

Level hierarchies consist of one or more levels of aggregation. Attributes roll up to the next higher level in a many-to-one relationship and members at this higher level roll up into the next higher level, and so on until they reach the highest level.
A hierarchy typically comprises of several levels, and you can include a single level in more than one hierarchy. A level hierarchy is rigid in nature, and you can access the root and child node in a defined order only.

Use Case:

Customer wants to analyze the sales revenue by customer country, state, and city. Now we will create a level hierarchy in our attribute view and access that using ‘MS Excel’ to analyze the sales revenue.

Example:

            Here I’m going to analyze the sales amount by Country.

To create an Attribute View:

Step 1: As we already know how to create attribute view. Simply Right Click your package and select Attribute View. A pop-up window will appear and provide the details and click ok. Here I named it as “AT_CUSTOMER_GEOGRAPHY”

Step 2: Drag and Drop the required tables in a “Data Foundation” and make the link between them based on a relationship. Here, I used two tables “Dim_Customer” and “Dim_Geograpghy”. And join it by using “Geography_Key” field.

Step 3: And now we create Level Hierarchy based on Geography location like country, state, city. To Create a Hierarchy, Click Semantics, from the Details pane select Hierarchies. A Pop-up window will appear. And provide details as Shown as Below: and click “OK”

Step 4: Then Validate and Activate the view.
Step 5: And create another Attribute view for Products. Do the same thing which we have done the above. Here I used “Product” table alone.

To Create an Analytic View:

Step 1: Simply Right Click your package and select Analytic View. A pop-up window will appear and provide the details and click ok. Here I named it as “AN_ADW_FACT_INTERNET_SALES”.
Step 2: Drag and Drop the required tables in a “Data Foundation” and make the link between them based on a relationship. Here, I used two Attribute views which we are created above.
Step 3: Drag and Drop the Fact table which contains measures in another Data Foundation. Here, I used “ADW_FACT_INTERNET_SALES”. Then join this to the attributes based on the relationship.

Step 4: Then Validate and Activate the view.

Excel:


Step 1: Open Excel and Click “Data” tab and select “From Other Sources” and Choose “From Data Connection Wizard”


Step 2: A Pop-up will appear. And choose “Other/Advanced” and Click “Next”.

Step 3: A Pop-up will appear “Data Link properties” select “SAP HANA MDX Provider” and Click Ok. A Pop-up window will appear as shown as below and provide required details. And click “ok”.

Step 4: A pop-up window will appear from this select your view which contains hierarchy. Here I choose “AN_ADW_FACT_INTERNET_SALES”. And click “Next”.

Step 5: Click “Finish”.
Step 6: Another “Import Data” pop-up will appear to select how we want to view our data from this select “Pivot table Report” and click “Ok”.


Result:

From the Pivot table Fields: select the field based on your requirement:
Here I choose following fields:

1.      HI_CUS_GEO
2.      OrderQuanity
3.      SalesAmount




Thak you...
Share your Comments...


Thursday 21 September 2017

SAP HANA: Analytic View

What is Analytic View?

            Analytic View is basically used to represents star models in HANA where the fact table is surrounded by different dimensions (master data). Analytic View is best suited for the scenarios where we need aggregated data from underlying tables that contain large data sets.
In SAP HANA Analytic view, dimension table is joined with the fact table that contains transaction data.
A dimension table contains descriptive data. (E.g. Product, Product Name, Vendor, customer, etc.). Fact Table contains both descriptive data and Measureable data (Amount, Tax, etc.).
SAP HANA Analytic view forms a cube-like structure, which is used for analysis of data.
Analytic views leverage the computing power of SAP HANA to calculate aggregate data, e. g., the number of bikes sold per country, or the maximum power consumed per month.
Optionally, attribute views can also be included in the analytic view definition. In this way, you can achieve an additional depth of attribute data.
You can model the following elements within an analytic view:
1.      Columns
2.      Calculated Columns
3.      Restricted Columns
4.      Variables
5.      Input Parameters
Node:
In the Semantics node, you can classify columns and calculated columns as type attributes and measures. The attributes you define in an analytic view are Local to that view. However, attributes coming from attribute views in an analytic view are Shared attributes.
You can choose to further fine-tune the behavior of the attributes and measures of an analytic view by setting the properties as follows:
·         Filters to restrict values that are selected when using the analytic view.
·         Attributes can be defined as Hidden so that they are able to be used in processes but are not viewable to end users.
·         The Drill Down Enabled property can be used to indicate if an attribute is available for further drill down when consumed.
·         Aggregation type on measures
·         Currency and Unit of Measure parameters (you can set the Measure Type property of a measure, and also in Calculated Column creation dialog, associate a measure with currency and unit of measure)

Creating an Analytic View:


Step 1: Right-click on your package select New and select Analytic View. And Provide the details and click OK.

Step 2: Drag and Drop the required tables in a Data foundation.

Step 3: Here, I used the “TH_EMP_SALARY” Table and EMPLOYEE_DETAILS Attribute View. And make a join between them by using their relationship. Here I make a link based on “EMP_ID”.
Step 4: Click validate and Activate the view.
Step 5: Data Preview result