Skip to Content
2
Former Member
Apr 03, 2012 at 10:29 PM

HANA Getting a Count of Unique values from a Column in graphical Calc View

8650 Views

Hello All,

I have following situation with a HANA Calculation View output

COLUMN1   COLUMN2   COLUMN3     
TECH111 A11111 MATERAL1
TECH111 A11112 MATERAL2
TECH111 A11112 MATERAL3
TECH111 A11113 MATERAL4
TECH112 A11113 MATERAL5
TECH112 A11114 MATERAL6
TECH112 A11115 MATERAL7
TECH112 A11116 MATERAL8

I want to get the count for each unique value papering in Column 2

i.e.A11111 appears 1 time, A11112 and A11113 appears 2 time and so on..

And In column 5 I would like to get a Total for All the instances (Sum of Column 4)

So the final output i need is shown below..

COLUMN1    COLUMN2  COLUMN3   ........COLUMN4    ........COLUMN5
TECH111 A11111 MATERAL1 1 12
TECH111 A11112 MATERAL2 2 12
TECH111 A11112 MATERAL3 2 12
TECH111 A11113 MATERAL4 2 12
TECH112 A11113 MATERAL5 2 12
TECH112 A11114 MATERAL6 1 12
TECH112 A11115 MATERAL7 1 12
TECH112 A11116 MATERAL8 1 12

I want to achieve this inside a graphical Calculation view. I tried to create a Calculated Column for the counter but it did not work. There are very limited functions available to use inside a Calculated Column. Do I have to get this done in SQL Script Calculation view? My preference is getting it done in Graphical Calculation view.

Under Distinct values tab of data preview I can see the exact output I want to see but is there any way to have that as a result of my Calc View?

There is something called as counters in the output of a calc view. It appears to be built for this purpose but it always gives a value of 1.

I would appreciate any inputs. Ideas. Thanks.

Regards

Abhijit