Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

doubt regarding cumulative sum in qlikview

Hi All,

I have doubt regarding how to write an expression for cumulative sum in a row, my requirement is as follows:

             jan   feb  mar   apr    may   jun

sale1      10   20   30      40    50      60

sale2      20  30    40      60     80      100

m1        10   10   10        20      30      40

m2         10   20   30       50       80     120

here m1= sale 2- sale1

m2 is previous month m2 plus current month m1

i.e., m2 of feb = 10(previous month m2) +10(current month m1)=20

m2 of mar= 20+ 10=30

Kindly help how to write this expression required as per my requirement

2 Replies
its_anandrjs

Load your table this ways

Data:

LOAD *,sale2-sale1 as m1;

LOAD * Inline

[

Month,sale1,sale2

jan,10,20

feb,20,30

mar,30,40

apr,40,60

may,50,80

jun,60,100

];

NoConcatenate

LOAD *,

RangeSum(m1, Peek('m2')) AS m2

Resident Data;

DROP Table Data;

Regards,

Anand

its_anandrjs

After loading create the pivot table

Dim1:- Month

Expr1:- =sum(sale1)

Expr2:- =sum(sale2)

Expr3:- =sum(m1)

Expr4:- =sum(m2)

Report.PNG