Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Cumulative sum

Hi guys,

I have the following

  

NamePurchase amountPurchase date
Bob501/01/2016
Bob501/10/2016
Bob1001/02/2016
Ed201/08/2016
Sid501/08/2016

Is there any way in my load script i can have a cumulative sum on purchase amount so the table ends up looking like this

 

NamePurchase amount
Bob20
Ed2
Sid5
1 Solution

Accepted Solutions
richard_chilvers
Specialist
Specialist

I suggest you use the GROUP BY feature in the load (check it out in the documentation.

It will be along the lines of:

LOAD Name, SUM([Purchase Amount]) as Total_Purchase

FROM ....................

GROUP BY Name;

Of course, in your example, this would give Bob a total of 20.

Do you need something different ?

View solution in original post

3 Replies
richard_chilvers
Specialist
Specialist

I suggest you use the GROUP BY feature in the load (check it out in the documentation.

It will be along the lines of:

LOAD Name, SUM([Purchase Amount]) as Total_Purchase

FROM ....................

GROUP BY Name;

Of course, in your example, this would give Bob a total of 20.

Do you need something different ?

Gysbert_Wassenaar

LOAD

     Name,

     Sum([Purchase amount]) as [Purchase amount]

GROUP BY

     Name;

LOAD DISTINCT * INLINE [

Name,Purchase amountPurchase date
Bob,5,01/01/2016
Bob,5,01/10/2016
Bob,10,01/02/2016
Ed,2,01/08/2016
Sid,5,01/08/2016

];


talk is cheap, supply exceeds demand
qlikview979
Specialist
Specialist

Hi Paul,

In your table  "Bob" having sum 20 like (10+5+5). how you calculated 15?


Regards