cancel
Showing results for 
Search instead for 
Did you mean: 

Processing a single table in HANA gives strange results

Former Member
0 Kudos

Nice to meet you all.

Use case:

I have a single table

EmpId
EmpName
EmpDept
Supervisor
E1SamPhysicsE2
E2RamChemistryE3
E3SanMathsE2
E4KumarBiologyE2
E5RaviTamilE2
E6GuruEnglish
E7SankarHindiE2
E8ManiComputerE1
E9SelvaElectronicsE4
E10RameshElectrical

The Supervisor is also an employee. Hence the Supervisor column has the EmpId of the Supervisor.

I need to find the EmpName Vs SupervisorName details

Following steps I did,

Step 1:

Created an attribute view, where I added the above table twice to get the SupervisorId and SupervisorName. The results are expected

Step 2:

Created an analytic view. Joined the above attribute view and the table.

But the actual result is wrong. For example, the supervisor name for E2 is Ram as per step 1 and table, but the result shows it as Kumar. None of the SupervisorId and SuperVisorName matches.

Please advice.

Accepted Solutions (0)

Answers (2)

Answers (2)

muthuram_shanmugavel2
Contributor
0 Kudos

Hi Guru,

if you notice step1 results,

Employee "E2" records are getting duplicated.

Because of this Analytic View results are wrong.

We can get this results simply by using SQL scripts.

using this SQL , You can create SQL view and would use SQL view in Calculation Views.

Else You can create scripted calculation view.

Select A.EmpID, A.EmpName, A.EmptDept, A.Supervisior, B.EmpName

From HIERARCHY A

Left Outer Join

HIERARCHY B

On A.Supervisior = B.EmpId

Regards,

Muthuram

former_member182465
Active Participant
0 Kudos

Hi Muthu,

Just logged in to share sql script but saw you have already done it.

former_member182465
Active Participant
0 Kudos

Hi Guru,

You should have posted this question in Inmemory HANA group not HANA use cases group.

There are lot of ways to resolve your issue. The procedure I used is as below.

1) created calculated view with Dimension type instead of Cube

2) Created 3 projections using Employee table

Projection 3 has filter as below

3) Then create the flow as below

Join Proj 1 and Proj 2 for getting empid etc to supervisorid and Supervisor Name

union the above output to Proj 3 to get all records. As proj 3 has records where supervisorid is blank as this records will be missed in inner join.

Join

Union

Final Projection below semantics

Semantics - Rename the below highlighted ones

4) Final Output

Experts please let me know if this procedure is not recommended.

You can also keep the filters on Proj 1 and Proj 2 with supervisor <> blank.

Guru try this and let me know if you face any difficulty.

Close this thread if your issue resolved.