Wednesday 31 May 2017

How Classify The Classes based on Percentage in SAP HANA

In this blog I am classifying the Student classes based on there percentage. If Student get above 60 percentage then they will get “FIRST CLASS” or If Student get between 60 to 50 percentage then they will get “SECOND CLASS” or If Student get below 50 percentage they will get “THIRD CLASS”.

For Implementing this scenario I took two calculated columns one for calculating Percentage other one for Specifying Class.

Below are the steps to implement “How Classify The Classes based on Percentage in SAP HANA”.

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

All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

Insert Below Values into our Table

All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

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

All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

Select STUDENT_DETAILS table in projection and Select the all columns.

All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

Create One calculated column for Calculating Percentage.

All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

Create another calculated column for calculated for class classification.

All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

Use the following logic to classifying the classes.

if(“MARKS_PERCENTAGE”>=60,‘FIRST CLASS’,if(“MARKS_PERCENTAGE”>=50 and “MARKS_PERCENTAGE”<60,‘SECOND CLASS’,if(“MARKS_PERCENTAGE”<50,‘THIRD CLASS’,‘FAIL’)))

Add projection to aggregation and select the calculated columns MARKS_PERCENTAGE and CLASS.

All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

Save and Activate the View.

select the data preview.

Output:


All SAP Modules, SAP Tutorials and Materials, SAP HANA Studio, HANA Calculation View, SAP HANA Modeling

Above output we can see the CLASSES Classification in last column.
SAP Online Guides, Tutorials, Materials and Certifications.

Related Posts

0 comments:

Post a Comment