15 Replies Latest reply: Oct 24, 2012 2:11 AM by Jannie Louw RSS

    Running Total

      How do calculate a running total (such as a bank balance) in a table box?

      I would like to calculate the running total for the following bank file

      No     Detail               Amount

      1         Start balance     10

      2          Deposited           5

      3          Withdrawn         -2

       

      to get the following Table Box:

      No     Detail               Amount     Balance

      1         Start balance     10          10

      2          Deposited           5          15   

      3          Withdrawn         -2          13

       

      If have tried to use the following

      SELECT


          `BankNo` As 'No',

           `BankDetail` As 'Detail',

          `BankAmount` As 'Amount',

          `Amount` + Previous(`Amount`) As 'Balance'

      FROM `db`.`bank` AS `bank`

       

      but I get the error message Function Previous does not exist?