Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Running Balance in a Pivot table, what's wrong with my code!!!!!

Hello,

I am making a pivot table and attempting to have the last column hold a running balance based on the other columns.

Here is what I want in plain English:

IF this is the first row, THEN take a field called 'JuneStartBal' and add to that value the Sum of a field called 'TotalRecByItem' then subtract from that the sum of a field called TotalReqByItem. ELSE (if this is not the first row), get the value from the previous row and add to that value the Sum of a field called 'TotalRecByItem' then subtract from that the sum of a field called TotalReqByItem.

Here is my broken code:

if(rowno()=1, JuneStartBal + (Sum ([TotalRecByItem])) - (Sum ([TotalReqByItem]) ), peek(Rowno() -1) + (Sum ([TotalRecByItem]) - (Sum ([TotalReqByItem]))))

Please help me!!! Thanks to all who assist!

3 Replies
Not applicable
Author

stumped

Not applicable
Author

ttt

Not applicable
Author

One last try, I always stump this forum