cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicates Issue with Aggregation in HANA Calculation view

former_member462348
Participant
0 Kudos

Hi Experts,

I have a below requirement, kindly help me to fix this.

Col A Col B

SAP ABAP
SAP ABAP
SAP SD
SAP HANA

when I use aggregation for the above table and make column B as aggregated column and aggregated type as "COUNT" am getting count value as 4 for SAP.

It providing me the total row count for SAP in the output. where as the expected count value should be "3". Since row 1 and 2 are duplicates.

Can someone help me, how to achieve the Count value as "3" for SAP in Output.

Thanks
Rufus Samuel

Accepted Solutions (0)

Answers (3)

Answers (3)

pfefferf
Active Contributor

You can do an aggregation before the aggregation you describe. The additional aggregation just needs both fields (as "normal" fields, not as aggregated ones) to eliminate duplicates.

Regards,
Florian

shanthi_bhaskar
Active Contributor
0 Kudos
SELECT  COUNT(DISTINCT(row_2)) FROM <SCHEMA>.TABLE
lbreddemann
Active Contributor
0 Kudos

This SQL is correct, but the brackets after DISTINCT are unnecessary.

DISTINCT is not a function and the brackets don't define what part of the count should be worked on by the DISTINCT.

shanthi_bhaskar
Active Contributor
0 Kudos

please refer below

This is my table

Thanks,

Shanthi.