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: 
marcvw
Partner - Contributor III
Partner - Contributor III

how to calculate cumulative amount

Hi all, 

Would like to calculate the cumalitive amount per employee, example is shown in below table. Challenge is that the line items per employee differ. Is it possible to calculate the cumulative amount? Appreciate your support in here. 

employee Amount Cumulative amount
A 1 1
A 2 3
A 3 6
B 4 4
B 5 6
C 2 2
C 4 6
C 6 12
C 8 20

 

Can this be done in Qlikview? 

Labels (3)
4 Replies
Ahidhar
Creator III
Creator III

try this

tab:
load employee,Amount,if(employee=previous(employee),
RangeSum(peek(Cumulative_Amount),Amount),Amount) as Cumulative_Amount;
load * Inline
[
employee, Amount
A, 1
A, 2
A, 3
B, 4
B, 5
C, 2
C, 4
C, 6
C, 8
];

Ahidhar_0-1704285517356.png

 

marcvw
Partner - Contributor III
Partner - Contributor III
Author

Hi Ahidhar, thank you for your response in here. As I'm utilizing qlikview, would the formula be the same? Thanks for your response in here. 

Brian_C
Contributor III
Contributor III

Hi 

Try the following expression to get the cumulative amount

Sum(Aggr(Sum(Amount),employee))

This will aggregate the amount over the employee.

Best wishes

B

Ahidhar
Creator III
Creator III

yes it will work