2 Replies Latest reply on Aug 13, 2012 10:36 AM by MarcMcCall

    Calculated Field SUM all records

    designpro

      Title

      Calculated Field SUM all records

      Post

      Excuse me if this seems like a very simple and stupid question.  I've looked through the documentation and read through the forums but can't figure out how to do this simple task.  I have a database set up that only has 6 fields.  I would like one of those fields to have a calculated amount that is the sum of one field from all of the records.  Currently I am using SUM (NameofField) however, it will only give me the value for the selected record and not all records in the file.  

      Thanks.

        • 1. Re: Calculated Field SUM all records
          philmodjunk

          Sum ( 5 )  produces the total 5.

          WHen you use Sum ( fieldName ), you are doing the same thing.

          Sum needs a list of values to sum in one of the following formats:

          Sum ( field1 ; field2 ; field3 ) // individual fields in the same record

          Sum ( RepeatingField ) // repetitions of single field are summed

          Sum (RelatedTable::Field ) // Value of field from all related records are summed

          None of these would seem to quite do what you want here, though the third option can be set up with a special self join relationship to do that.

          But there's a simpler option: Add a field of type Summary instead of a calculation field. Specfiy that it compute the "total of" the field you want to total.

          Note: This computes the total for all records in your current found set--to get a total of all records in your table requires putting all records in your found set--which can be done with Show All Records. If you need a total of all records in the table when you don't have all records in your found set, you'll need to use the "self join relationship" method I referred to earlier. Respond back here if that's the case and I'll respond with a detailed description of how you can set that up.

          • 2. Re: Calculated Field SUM all records
            MarcMcCall

            Create a sumary field instead of a calculation field.