Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I apply a cumulative sum to a series of data containing monthly sales?

Hi

If I have data organised in two columns:

([Month])

([sales value])   the data in this column is simply the sales volume for the month in the adjacent column

And I want to display the monthly sales as a cumulative result, what is the simplest expression to use?

Example:

Month          Sales value

Jan               £200

Feb               £190

March           £75

April               £140

May               £50

Thanks!

1 Solution

Accepted Solutions
sunny_talwar

May be this

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

View solution in original post

3 Replies
sunny_talwar

May be this

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

OmarBenSalem

There is 2 ways to work this through; you can apply the expression that Sunny wrote;


Or you can build a new field in the script; let's call it asOfMonth in your calendar, and choose it as a dimension keeping the same expression :sum(Sales).

See the article below:

The As-Of Table

Not applicable
Author

LOAD

Month,

sale,

RangeSum(sale, peek( 'cum_sum' )) as cum_sum //cumulative sum

;

LOAD * INLINE [

    Month, sale

    Jan, 200

    Feb, 190

    March, 75

    April, 140

    May, 50

];