This is a document how you can create a cumulative calculation using HANA Graphical Calculation View. It is one of the easy example, but you can extend it to any complex scenario.
I am creating a Simple file like this and our aim is to create the cumulative column as show bellow.
I am creating a Simple file like this and our aim is to create the cumulative column as show bellow.
Product | Annual Sales(USD) | Cumulative Sum Sales |
1070 | 3600 | 3600 |
1050 | 336 | 3969 |
1020 | 220 | 4156 |
1060 | 192 | 4348 |
Step 1: Create a CSV file mention above. The file is already attached in this portal.
Step 2: Consume the CSV file in HANA and create a Table (Table Name: Zt_Sales_001).
Step 3: Create a HANA Model / Calculation View name CA_DATA_ CUMULATIVE_001
Step 4: Take a projection and consume the table you have created.
Step 5: Create a DUMMY filed with a constant value like ‘1’ (As created in the system)
Step 6: Then use a Rank Functionality to get the sequence number of the data.
Step 7: Divided the flow into 2 different projections, and again join with DUMMY field. You will get M*N number of field.
Step 8: Add 2 calculative column create with following logic. One is Equal to sequence and other is Greater than Equally of sequence. Please have the logic.
Step 9: Put a filter with Value ‘Y’ on top of the Sequence Column.
Step 10: Put an Aggregation node on top of Projection node (which has the Greater than Equally of sequence filter). Then Do the aggregation on top of total sales column.
Step 11: Now Put a Join node and join Projection and aggression node and join on Product field.
Step 12: Execute the field and see the output.
Source: scn.sap.com
No comments:
Post a Comment