Quantcast
Channel: SCN : Document List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 1183

SAP HANA: Implementing RANK using Graphical calculation View

$
0
0

Hi Folks,

 

As mentioned in this blog:

SAP HANA: Dynamic Ranking using Script based (SQL Script) Vs Graphical Calculation view Vs Script based (CE Functions)

 

As requested in the above blog, collaborating with this document on the steps i have used to create the graphical view . Please do suggest your opinions to make it better.

 

Will explain the each node here on how we can build the graphical calculation view and get rank in it.

 

Screen Shot 2014-07-04 at 4.49.19 PM.png

 

Projection 1 & 2 : We select the required columns i.e Employee Name,Region and Salary and create a "dummy" column with constant value 1 as shown below:

 

Screen Shot 2014-07-04 at 4.50.50 PM.png

 

Join 1: ( Projection 1 & 2 joined on dummy column )

 

Screen Shot 2014-07-04 at 4.51.57 PM.png

 

Aggregation 2 : ( Aggregate salary as "Minumum" and add "dummy" column to apply the group by )

 

Screen Shot 2014-07-04 at 4.53.22 PM.png

 

Join 2 : ( Joining Aggregation 2 and Projection 1 on dummy column )

 

Screen Shot 2014-07-04 at 4.53.47 PM.png

 

 

Projection 3 : ( Apply filter SALARY_1 < SALARY )

 

Screen Shot 2014-07-04 at 4.54.54 PM.png

 

Aggregation 1: ( Add EMPLOYEE_NAME_1 as "Aggregated column" and apply Count on it  at EMPLOYEE NAME,REGION,SALARY level)

 

Screen Shot 2014-07-04 at 4.57.22 PM.png

 

Projection 4: ( Add a calculated column Rank with formula RANK1 + 1  -- To get the ranks from 2)

 

Screen Shot 2014-07-04 at 4.58.54 PM.png

 

 

Projection 6: ( Apply filter SALARY = MINUMUM and add it to Rank = 1 as calculated column )

 

Screen Shot 2014-07-04 at 5.00.42 PM.png

 

Projection 7 & 5 : Choose the required columns i.e EMPLOYEE_NAME,REGION,SALARY and RANK

 

Screen Shot 2014-07-04 at 5.02.26 PM.png

UNION_1 ( Map both Projection 7 & 5 in the union )

 

Screen Shot 2014-07-04 at 5.03.12 PM.png

 

Now you can see in the data preview we can see the RANK column showing us the desired output.

 

Screen Shot 2014-07-04 at 5.04.58 PM.png

 

Hope this navigations is clear.

 

Your's

Krishna Tangudu


Viewing all articles
Browse latest Browse all 1183

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>