3 Replies Latest reply on Jul 2, 2014 3:35 PM by philmodjunk

    Need running total calculation



      Need running total calculation


           I am trying to figure out how to have a running total yet not sure how to accomplish it.

           I want to start with a number say 400.00, put 5.00 in "change" (this number will always change per entry), number * change = sub total then starting number (400.00) + sub total will = grand total. On the next entry the starting number would be the Grand total from the previous entry.


        • 1. Re: Need running total calculation

               I'm not sure that I get how multiplying one number by another is supposed to produce a "running total".

               Is this what you meant?

               Number      Total
               400             400                  (starting amount)
               5                 2000               (400 * 5)
               3                 6000                (2000 * 3 )

               Or do you have a different progression of values in mind?

          • 2. Re: Need running total calculation

                 Nope, you're right. So how do i write that in FM?  I  know how to do it in Excel but not in FM.

                 Thank you for your help!!

            • 3. Re: Need running total calculation

                   Unlike Excel, the rows of data are fully dynamic. Any number of different records may be arranged in any number of different orders. This can affect what options work best to get the results that you want.

                   Here is one method, but it does not work in all situations:

                   Define a number field named Factor.

                   Define a calculation field, cTotal for your running total as a calculation field: factor * NumberField

                   Now return to Factor and give it this auto-enter calculation:

                   Let ( r = Get ( RecordNumber ) ; If ( r = 1 ; 1 ; getNthRecord ( cTotal ; r )  ) )

                   Put NumberField and cTotal on your layout. Enter numbers into NumberField, creating new records as needed.

                   As long as all the records are in your current found set and not sorted into a different order, cTotal will show the correct running total.