Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Straight Table Puzzle

Hi

Im having difficulty doing something simple with my straight table. I trying to have some balances brought down to the next row and shown in different columns

I have the following dataset:

DayIn PocketOut Of Pocket
1105
21011
3818
41211
51310
6920
756

My end result will have to look like this:

DayBalanceIn PocketOut Of PocketAvailableTo Be Paid
1010550
25101140
3481806
40121110
51131040
6492007
705601

On the first day the balance will always start with 0 then the Available and To Be Paid is a simple subtraction of "In Pocket - Out Of Pocket" (if its positive the amount goes to Available and brought forward to the Balance of the next row, if its negative its value is shown in the To Be Paid column).

Any help?

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

2015-08-25 #1.PNG

Balance:          If( RowNo(TOTAL) = 1 , 0 , Above( Available) )

In Pocket:       [In Pocket]

Out of Pocket:  [Out of Pocket]

Available:         If( Balance + [In Pocket] - [Out Of Pocket] < 0 , 0 , Balance + [In Pocket] - [Out Of Pocket] )

To Be Paid:      -If( Balance + [In Pocket] - [Out Of Pocket] < 0 , Balance + [In Pocket] - [Out Of Pocket] , 0 )

See also attached QVW...

View solution in original post

4 Replies
petter
Partner - Champion III
Partner - Champion III

2015-08-25 #1.PNG

Balance:          If( RowNo(TOTAL) = 1 , 0 , Above( Available) )

In Pocket:       [In Pocket]

Out of Pocket:  [Out of Pocket]

Available:         If( Balance + [In Pocket] - [Out Of Pocket] < 0 , 0 , Balance + [In Pocket] - [Out Of Pocket] )

To Be Paid:      -If( Balance + [In Pocket] - [Out Of Pocket] < 0 , Balance + [In Pocket] - [Out Of Pocket] , 0 )

See also attached QVW...

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Here is the solution.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Brilliant thank you very much! I missed the first formula in my calcs

Not applicable
Author

Script alternative also correct thank you very much!