Thursday, 1 June 2017

How To Find Average In Calculated Column Using Calculation View In SAP HANA

Average : The sum of all of the numbers in a list divided by the number of items in that list.

In my calculation view I am taking student four subject marks and finding the average to that marks using Calculated Column.

Calculated Column : It is an additional column which can be created by us, the results of which are calculated at run time based on the existing column and using either functions, input parameters and constants.

Following are the steps to implement “How To Find Average In Calculated Column Using Calculation View In SAP HANA”.

Step 1: Create one Table with the name “STUDENT_DETAILS” in our schema with following structure

Calculation View In SAP HANA, SAP HANA Materials, SAP HANA Certifications

Insert Below Values into our Table

Calculation View In SAP HANA, SAP HANA Materials, SAP HANA Certifications

Step 2: Create Calculation view in our package with the name “STUDENT_CLASS

Calculation View In SAP HANA, SAP HANA Materials, SAP HANA Certifications

Select STUDENT_DETAILS table in projection and Select the all columns.

Calculation View In SAP HANA, SAP HANA Materials, SAP HANA Certifications

Create One calculated column for Calculating Average.

Calculation View In SAP HANA, SAP HANA Materials, SAP HANA Certifications

Add projection to aggregation and select the calculated columns MARKS_PERCENTAGE

Calculation View In SAP HANA, SAP HANA Materials, SAP HANA Certifications

Save and Activate the View.

select the data preview.

Output:

Calculation View In SAP HANA, SAP HANA Materials, SAP HANA Certifications

Above output we can see the Average in last column.