 # Cumulative Sum Expression Writing In Qlik Sense

There may be instances where you’d like to calculate the cumulative sum in a chart in Qlik Sense. For example, you may want to look at sales values cumulatively summed in a bar chart for selected invoice months. On the other hand, maybe you want to accumulate subscription dollars over time to see how individual companies are growing within your ecosystem.

Cumulative sums or accumulation is possible in Qlik Sense; however, it may be challenging for the novice user to write the expressions to accomplish this. Formerly, in QlikView, you could select the ‘Full accumulation’ setting on the Expressions tab in the chart properties. However, there’s no such functionality in Qlik Sense unless you are using version Qlik Sense November 2019 and above. If you are using any version prior to the Qlik Sense November 2019 release, there is no native option for accumulated expressions in the user interface. As a result, you will need to create these expressions manually.

In that case, you are probably wondering how we can accomplish creating the accumulation or cumulative sum expressions in Qlik Sense… Without delay, let’s take a look.

## Leveraging RangeSum() and Above() Functions for Accumulation Expression Writing in Qlik Sense

In Qlik Sense, we can use the RangeSum() function in combination with the Above() function to accumulate the values needed.

### RangeSum() Function

RangeSum() returns the sum of a range of values. All non-numeric values are treated as 0.

Syntax: RangeSum(first_expr[, Expression])

Examples:

### Above() Function

Above() evaluates an expression at a row above the current row within a column segment in a table. The calculated row depends on the value of offset, if present, the default being the row directly above. For charts other than tables, Above() evaluations for the row above the current row in the chart’s straight table equivalent.

Syntax: Above([TOTAL] expr [, offset, [, count]])

Examples:

## Creating the Cumulative Sum Expression in Qlik Sense

Finally, with a better understanding of the RangeSum() and Above() functions, we can create our expression using a combination of the two functions to find the cumulative sum of Sales in Qlik Sense.

RangeSum(Above(sum(Sales),0,RowNo()))

In other words, this expression returns the cumulative values for sum(Sales) from the current row (specified with an offset of 0) and accumulates all preceding rows (specified with a count of RowNo()).

To further demonstrate, here’s the expression used in Expression Editor of Bar Chart:

The output:

## Conclusion

To summarize, if you’re using any version of Qlik Sense prior to the November 2019 release, you can use the expression above to perform accumulation or cumulatively sum values. Additionally, with the detailed explanations of the Rangesum() and Above() functions, you can modify the expression to fit the precise needs of you and your business.