Jump to content
  • 0

Calculated field for running balance


focus54
 Share

Question

I'm looking for a way to add a calculated balance column on each row that contains a running balance by taking the balance value from the previous row and adding/subtracting values from current row to arrive at a new balance.

result set includes "increase" and "decrease" columns:

Increase ----- Decrease ------- Balance (calculated)

100 --------------------------- 100

400 --------------------------- 500

---------------- 200 ---------- 300

-200 --------------------------100

--------------- -300 ---------- 400

These values will be currency with 2 decimals but I think we can ignore that for now.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Are there any newbie friendly resources that might be able to help me with something like this.

 

I'm trying to create an app that logs points, gives users the ability to redeem points and keeps a running balance based on both.

 

I have looked at JS and appears daunting.....

 

Thanks in advance.

Link to comment
Share on other sites

  • 0

Hi all!

You can also use Calculated field in the Reports DataPage to display the running balance: 

(SELECT SUM(ISNULL([@field:Increase],0) - ISNULL([@field:Decrease],0)) FROM Running_Balance WHERE Code= target.[@field:Code] AND ID <= target.[@field:ID])

You may check this for reference:

https://c0acp706.caspio.com/dp/2d9860007b629b8a4b074df5af34

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...