2 weeks ago
Hi friends,
I am trying to create calculated columns in a HANA Calculation View. The calculated columns should show the sum of IDs with same characteristics. E.g. we have 7 IDs with the TYPE "W05" and 6 IDs with the TYPE "W10". The endresult should contain the table with all IDs, where we have in the calculated column the values "7" or "6" in each row with TYPE "W05" or Type "W10".
Here is an example of three calculated columns that I need to create (AMOUNT_SAME_TYPE, AMOUNT_SAME_TYPE_CHARNAM_CHARVAL, AMOUNT_SAME_CHARNAM_CHARVAL):
ID | TYPE | CHARNAM | CHARVAL | AMOUNT_SAME_TYPE | AMOUNT_SAME_TYPE_CHARNAM_CHARVAL | AMOUNT_SAME_CHARNAM_CHARVAL |
W05001 | W05 | GW_G02 | 242 | 7 | 3 | 6 |
W05002 | W05 | GW_G02 | 242 | 7 | 3 | 6 |
W05003 | W05 | GW_G02 | 242 | 7 | 3 | 6 |
W05004 | W05 | GW_G02 | 354 | 7 | 2 | 3 |
W05005 | W05 | GW_G02 | 354 | 7 | 2 | 3 |
W05006 | W05 | GW_D07 | 100 | 7 | 1 | 2 |
W05007 | W05 | GW_D07 | 200 | 7 | 1 | 2 |
W10001 | W10 | GW_G02 | 242 | 6 | 3 | 6 |
W10002 | W10 | GW_G02 | 242 | 6 | 3 | 6 |
W10003 | W10 | GW_G02 | 242 | 6 | 3 | 6 |
W10005 | W10 | GW_G02 | 354 | 6 | 1 | 3 |
W10006 | W10 | GW_D07 | 100 | 6 | 1 | 2 |
W10007 | W10 | GW_D07 | 200 | 6 | 1 | 2 |
I have no idea, how I can archieve this.. Is here an expert that could help me with my issue?
I could solve the first keyfigure by a tablefunction with the select code:
COUNT(*) OVER(PARTITION BY TYPE) AS AMOUNT_SAME_TYPE
but unfortunately the PARTITION BY argument does not work for more than one field?!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.