Let us learn what is a calculation view in SAP HANA and how to create a calculation view in HANA with a step by step approach.
What is a Calculation View in SAP HANA?
- Calculation views enable to model a complex dataset which requires more advanced processing as compared to an Analytic view or an Attribute view.
- A Calculation view is used in scenarios where Attribute view or Analytic view is unable to properly express a calculation or a business requirement.
- A Calculation view can also consume Analytic view or an Attribute view.
- However, as per the trend, HANA developers now directly create a complex calculation view in HANA instead of creating an Attribute/Analytic view and then consuming it in a calculation view.
There are 2 methods of creating a calculation view:
- Calculation view using Graphical User Interface (GUI)
- Calculation view using SQL Script
How To Create Calculation View – Step By Step Guide
Step 1: Navigation
To create a calculation view in HANA, right-click on a package name, select New and go to Calculation view option.
Step 2: Calculation View Properties
You will get a dialog box which will enable you to set the initial properties of a Calculation view. Let’s go through them below.
- Name: This is a mandatory field and is not changeable. The only way to change the Name of a calculation view is the Refactor option. The naming convention to be used here should be technical.
- Label: This represents the description of a HANA view and can be a free text like general English. The naming convention used here is User-friendly. The Label is usually what you see when you connect this view to front-end sources like Web Intelligence, Analysis for Office, etc.
- Package: This populates by default when you right-clicked on the package name in the first step.
- View Type: This option enables you to select one of the three options: Calculation view, Analytic view and Attribute view.
- Copy From: If you want a particular view to be replicated in this new HANA calculation view, you check Copy From option and select the original view.
- Data Category: There are 2 options here viz. CUBE and DIMENSION. If you select CUBE, the view will have an Aggregation node at the top which will basically aggregate all your measures based on the attributes.
If you select DIMENSION, the calculation view will have a Projection node at the top and therefore, will not aggregate the dataset.
It is always recommended to create calculation view with Dimension in SAP HANA if you do not wish to aggregate data, which is performance efficient as compared to CUBE data category
- With Star Join: This property enables the Star Join node in the calculation view. As Star Join helps in simplification of the HANA view design. It is, therefore, not required to create an Analytic view or an Attribute view. You can, instead, directly used Fact tables as Projection nodes.
Step 3: Final Calculation View (The Big Picture)
After you’ve completed step 2, you will get to see the complete view of the HANA view with a wide variety of further options.
- Scenario: This portion includes the Graphical version of the HANA view where you can drag and drop the elements on the panel.
- Palette: You can drag multiple elements from Palette window based on the requirement: Projection, Join, Aggregation, Rank, and Union.
- Detail: This portion includes the dataset or the columns (attributes and measures) that you have selected or added to the output in the underlying projection, aggregation, union, join or a rank node.
- Output: This panel includes the attributes and measures selected for further modifications to the properties of them.
The top section enables us to create calculation columns in calculation view whereas the bottom portion – Properties enables us to figure out property related to a field such as length, datatype, label, name, mapping and much more.
If you have any doubts regarding Calculation view in SAP HANA, please mention about it in the comment section below.