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: 
Not applicable

Pivot table Help ?

I need your Help please,

My Problem is the following :

Client N°
Réference
Débit
Crédit
NewSolde
Client1Ref1100

Client1Ref2
200
Client1Ref3150

Client1Ref4
125

I want to calculate the new solde after each line per client.

For each client i have a initial Solde

New solde solde = Initial solde + sum(Crédit) - sum(Débit) for the first line

after that NewSolde= Newsolde + sum(Crédit) - sum(Débit) for each Client.

How can i do this with Pivot table ?

Thanks in advance for your Help.

2 Replies
Lee_Matthews
Former Employee
Former Employee

You can possibly do this using the AGGR function. This function allows you create sub-totals based on a custom aggregation within each row. It does not reference the row above as you describe, but may allow you to create aggregation logic that will mimic what you want. But it would rely on the table having a specific sort order for the logic to work that way you want. Though I suspect your logic will need to be based on some natural sequence anyway.

That said, I think the better (and simpler) approach would be to build the calculation in your load script using the Peek function.

Lee_Matthews
Former Employee
Former Employee

Actually, this excellent blog post by Elif may provide the solution if you want to do it in the chart: http://community.qlik.com/blogs/qlikviewdesignblog/2012/10/12/accumulative-sums.

Althoug I would still probably do it in the load script as suggested above.