Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 14, 2017 at 08:59 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 16, 2017 at 11:24 AM

    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
    Add comment
    10|10000 characters needed characters exceeded