Skip to Content
0

Can we use Calculated Columns in Aggregation node

May 29, 2017 at 11:22 AM

26

avatar image

Hello Experts,

I am trying to do some calculation ( counts and sum of amount)

For counts i have created a few calculated columns like below

if ( in("TYPE", 'Machines' , 'Miscellaneous' , 'Parts' , 'Past Due Charge'),1,0)

defined as integers.

And when i am trying to sum up the counts its always give me 1, where as the other values like amounts gets summed up.

Basically the source is an another CA view (type Cube). I have 2 rows coming from view whose total sum of amount equals the amount from my view,

whereas the count is always 1.

Below is the current SQL from HANA Scripted CA view, I am converting this to a Graphical one

select partner,

DUE_DATE ,

COMP_CODE,

COUNT(CASE WHEN TYPE = 'Machines' OR TYPE = 'Miscellaneous' OR TYPE = 'Parts' OR TYPE = 'Past Due Charge' THEN TYPE END) AS "COUNT",

SUM(AMT_OWED ) AS "AMOUNT"

from table

group by

partner, DUE_DATE , COMP_CODE

Any thouhts???

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

0 Answers