Skip to main content
Announcements
Qlik Launches Open Lakehouse and advanced agentic AI experience in Qlik Answers! | LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
MT4T
Creator

Above with self reference

Hello,

Below is my sample data. I need to do calculation of running Balance in table / pivot.

I need to return value based on calculation like in Final balance column

In Description_____FINAL BALANCE is logical function.

I cannot find proper syntax for this calculation.

I tried various above syntax but it works differently as I expected.

PO Unposted_Qty WH_Qty MPS_Qty Order_Qty Balance_Qty Final balance Description_____FINAL BALANCE ABOVE TRY
67D 5 0 0 0 -5 -5 -5  
69L 18 0 0 0 -18 -23 -18+(-5) -23
69U 6 5 0 0 -1 -24 -1+(-23) -19
69Y 0 13 0 0 13 -11 13+(-24) 12
70N 5 5 0 0 0 -11 0+(-11) 13
71B 0 161 0 0 161 150 161+(-11) 174
71I 0 5 0 5 0 150 0+(150) 161
71K 0 1 0 0 1 151 1+(150) 1
71Q 44 0 0 0 -44 107 -44+(151) -43
73M 34 34 0 0 0 107 0+(107) -44
74M 100 0 0 0 -100 7 -100+(107) -100
77J 0 0 0 3 -3 4 -3(+7) -103
77L 0 1 0 0 1 5 1+(4) -2
77Q 15 0 0 0 -15 -10 -15+(5) -14
77U 0 70 0 0 70 60 70+(-10) 55
77X 0 1 0 0 1 61 1+(60) 71
78N 2 0 0 0 -2 59 -2(+61) -1

 

 

Labels (4)
1 Solution

Accepted Solutions
williejacobs
Creator

Hi @MT4T 

I would suggest one of these 2 solutions 

williejacobs_0-1670597956075.png

rangesum( above( sum(Balance_Qty),0,rowno()))

This will give you issues if you add more than 1 Dimension.

 

 

 

View solution in original post

2 Replies
williejacobs
Creator

Hi @MT4T 

I would suggest one of these 2 solutions 

williejacobs_0-1670597956075.png

rangesum( above( sum(Balance_Qty),0,rowno()))

This will give you issues if you add more than 1 Dimension.

 

 

 

MT4T
Creator
Author

Thank you, in meanwhile i have found in measure properties "accumulation" modifier but this function is much more flexible.