[go: up one dir, main page]

0% found this document useful (0 votes)
14 views2 pages

SAP HANA Calculation Views Guide

A calculation view in SAP HANA is a virtual data model that enables complex calculations on data from various sources, created using graphical or SQL Script methods. Graphical views use nodes for operations like aggregation and filtering, while SQL Script views are user-defined functions that return tables and allow for complex logic through SQL statements. Examples include a graphical view aggregating sales by category and region, and a SQL Script view returning the top 10 customers by revenue.

Uploaded by

1nonlypriyo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

SAP HANA Calculation Views Guide

A calculation view in SAP HANA is a virtual data model that enables complex calculations on data from various sources, created using graphical or SQL Script methods. Graphical views use nodes for operations like aggregation and filtering, while SQL Script views are user-defined functions that return tables and allow for complex logic through SQL statements. Examples include a graphical view aggregating sales by category and region, and a SQL Script view returning the top 10 customers by revenue.

Uploaded by

1nonlypriyo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Explore

A calculation view in SAP HANA is a virtual data model that allows you to perform
complex calculations on data from various sources. You can create graphical or SQL
Script-based calculation views using SAP HANA Studio or Eclipse 1.

A graphical calculation view consists of nodes that represent different operations,


such as projection, aggregation, join, union, and rank. You can drag and drop tables,
views, or other calculation views as data sources and map the columns to the output.
You can also define filters, variables, and parameters to customize the data selection
and calculation logic 23.

A SQL Script-based calculation view is a user-defined function that returns a table as


output. You can write SQL statements to manipulate data from tables, views, or other
calculation views. You can also use SQL Script features, such as control structures,
expressions, and procedures, to implement complex logic 1.

Here is an example of a graphical calculation view that aggregates the sales amount
by product category and region:
calculation view: SALES_BY_CATEGORY_REGION
output columns: CATEGORY, REGION, AMOUNT
aggregation node: AGGREGATE_SALES
data source: SalesItems table
mapped columns: CATEGORY, REGION, AMOUNT
aggregation type: MAX for AMOUNT column
Here is an example of a SQL Script-based calculation view that returns the top 10
customers by revenue:
calculation view: TOP_CUSTOMERS
output columns: CUSTOMER_ID, CUSTOMER_NAME, REVENUE
SQL Script:

CREATE FUNCTION TOP_CUSTOMERS ( )


RETURNS TABLE ( CUSTOMER_ID INTEGER, CUSTOMER_NAME VARCHAR(100), REVENUE
DECIMAL(15,2) )
AS
BEGIN
RETURN (
SELECT TOP 10 C.ID AS CUSTOMER_ID, C.NAME AS CUSTOMER_NAME, SUM(S.AMOUNT)
AS REVENUE
FROM CUSTOMERS C
INNER JOIN SALES S ON C.ID = S.CUSTOMER_ID
GROUP BY C.ID, C.NAME
ORDER BY REVENUE DESC
);
END;

You might also like