SAP HANA: Implementing RANK using Graphical calculation View
As mentioned in this blog:
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.
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:
Join 1: ( Projection 1 & 2 joined on dummy column )
Aggregation 2 : ( Aggregate salary as “Minumum” and add “dummy” column to apply the group by )
Join 2 : ( Joining Aggregation 2 and Projection 1 on dummy column )
Projection 3 : ( Apply filter SALARY_1 < SALARY )
Aggregation 1: ( Add EMPLOYEE_NAME_1 as “Aggregated column” and apply Count on it at EMPLOYEE NAME,REGION,SALARY level)
Projection 4: ( Add a calculated column Rank with formula RANK1 + 1 — To get the ranks from 2)
Projection 6: ( Apply filter SALARY = MINUMUM and add it to Rank = 1 as calculated column )
Projection 7 & 5 : Choose the required columns i.e EMPLOYEE_NAME,REGION,SALARY and RANK
UNION_1 ( Map both Projection 7 & 5 in the union )
Now you can see in the data preview we can see the RANK column showing us the desired output.
Hope this navigations is clear.