Skip to Content
0

How to perform the Count Operation for a Column, based on the values in the other Column

Jun 14, 2017 at 06:43 PM

44

avatar image

HI Experts,

I have a requirement to display the count value for a Column, but this count is not only based on the single column. This count value is based on two columns.

Column A Column B Result
SAP AA 2
SAP BB 2
ORACLE CC 1
JAVA DD 3
JAVA EE 3
JAVA FF 3


So here the SAP has two different entries of column B, so the result should be 2.

Can i get this kind of output in HANA Calculation view

Thanks
Rufus Samuel

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Florian Pfeffer
Jun 14, 2017 at 08:59 PM
0

Just with calc. view options in the modeller you can create an aggregation path just for column a. The result then can be mapped back to the original data via a self join.

If it is possible for you, you can also use a user defined table function as data source in your graphical calc. view. Within that function you can use a window function to calculate your result:

select columna, columnb, count(*) over (partition by columna) as result
from <your table>;

Regards,
Florian

Share
10 |10000 characters needed characters left characters exceeded
RUFUS SAMUEL Jun 16, 2017 at 11:24 AM
0

Hi Florian

Can you provide me the code for this example, so that I can directly try that in my Calculation view

Column A Column B Result
SAP AA 2
SAP AA 2
ORACLE BB 1
JAVA CC 3
JAVA CC 3
JAVA CC 3

Thanks
Rufus Samuel
Share
10 |10000 characters needed characters left characters exceeded