The key data modeling object in SAP HANA is the calculation view. A calculation view is a graphical object that describes all the data processing steps from raw data to the final, consumable output.
Common data processing steps include filtering data, combining data, aggregating data, calculating new values, converting values and ranking data. Calculation views are built in layers so that each calculation view can consume other calculation views to form a stack of super-models. This approach promotes reuse of calculation views at the lower levels.
The processed data is never stored, but is generated each time the calculation view is executed. This is why calculation views are often found in scenarios where the source data changes frequently.
Calculation views run in the memory of the SAP HANA database, so high performance should be expected.
A calculation view can include common modeling steps such as:
The first step when creating a calculation view is to choose a name for the view and a data category.
The main data categories of calculation view are:
- Dimension - projects master data and mainly used in a star join
- Cube - supports multi-dimensional drill-down and can also be part of a star join
- Star Join - this is a star schema combining a cube and one or more dimensions
- SQL Access Only - a general purpose view that can be easily ready by SQL
To illustrate how calculation views are combined, let`s have a look at a simple example.
The data modeler chooses a data source such as a table or another calculation view and then selects the columns required. Filters can be applied to limit the data. New columns with formula expressions can be created.
Dimension calculation views are reusable building blocks. They represent the master data from the source systems and appear in many other calculation views.
Hierarchies can be defined in a calculation view to organize the data in a structured way.
Let us have a look at a demonstration how a parent child hierarchy is created.
There are two types of hierarchy in SAP HANA calculation views :
- Level Hierarchy
- The source table provides a row for each leaf (lowest level node) of the hierarchy
- For each higher hierarchy level, the row provides a dedicated attribute
- Each path in the hierarchy has the same length
- Parent-Child Hierarchy
- The source table provides a row for each hierarchy node, including intermediate nodes.
- The row provides the parent node on the next higher hierarchy level (link information).
- There might be shorter and longer paths in the hierarchy.
If you want to enable the business user to influence a filter, a formula, currency conversion, or any other expression, an input parameter can be used that asks for a rate, date, text string, or currency.
For example, you can ask the business user to select a customer and which discount or tax rate should be applied for the sales values.
You might work with calculation views if you are supporting a SAP Business Suite customer. That is because SAP provides a ready-made virtual data model called SAP HANA Live that provides operational analytics for SAP Business Suite.
SAP HANA Live is built and maintained by SAP using SAP HANA calculation views. This model provides consumable data shapes that are ready for use in any analysis tool. Understanding how a calculation view works is helpful in this scenario so that you are able to identify the source tables and columns and processing steps that the data takes before reaching the analytical tools.