Successful implementation of Cumulative Sum in SAP HANA

A cumulative sum is a sequence of partial sums of a given sequence. For example, the cumulative sums of the sequence {a,b,c,...}, are aa+ba+b+c, …. Cumulative sums.
Cumulative Sum:Cumulative sums, or running totals, are used to display the total sum of data as it grows with time (or any other series or progression). This lets you view the total contribution so far of a given measure against time.
If you’re a frequent user of the SUM function, you may occasionally want to take the cumulative SUM of a value across a table. For example, if you have a table that outlines product sales by month for an entire year, you may want to insert a cumulative SUM column that shows year-to-date sales at the end of each month.
This can be easily accomplished using relative and absolute cell references combined with the SUM function. Let’s take a look at how it works.
Following are the steps to implement Cumulative Sum in SAP HANA
Step 1: Create a table and Insert the data into the table.
Created “CUMMULATIVE_SUM” table using SQL Console.

Insert the data into “CUMMULATIVE_SUM” table

Step 2 : Create Script based calculation view with the name “CLV_CUMMULATIVE_SUM_SCRIPT_BASED”

Click on Finish button

/********* Begin Procedure Script ************/  /********* Begin Procedure Script ************/
/********* End Procedure Script ************/
Save and Validate the view then
Save and Activate the View
Step 3: Check the output
click on Data preview button to see the output


  1. Thank you for giving this best information. It’s a very nice topic
    SAP HANA Remote Online Access

  2. Hello, thank you very much! ... But, what to do when the query has more than 2 descriptive columns? I have had problems at different levels of aggregation. Thanks for the help.


Post a comment

Popular posts from this blog

How To Implement SQL Analytic Privilege in SAP HANA

How To Implement Smart Data Access in SAP HANA