How To Find Average In Calculated Column Using Calculation View In SAP HANA
In this blog I am going to explaining about How To Find Average.
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
Insert Below Values into our Table
Step 2: Create Calculation view in our package with the name “STUDENT_CLASS”
Select STUDENT_DETAILS table in projection and Select the all columns.
Create One calculated column for Calculating Average.
Add projection to aggregation and select the calculated columns MARKS_PERCENTAGE
Save and Activate the View.
select the data preview.
Output:
Above output we can see the Average in last column.
I am confused. Is there any other way to calculate an Average?
No, an average is the sum of a list of numbers divided by the number of numbers in the list.
In my Blog I am taking (“SUBJECT1″+”SUBJECT2″+”SUBJECT3″+”SUBJECT4”)/4 logic to calculate average.
Thanks,
Krishna Reddy Hanmaiahgari.
So you are saying adding the value of 4 subjects and dividing by 4 is different from how an Average is normally calculated?
No, Both are same.