4 Replies Latest reply on Mar 30, 2011 9:41 AM by truji_

    Sum question



      Sum question


      I have a table called courses.

      the fields I have are:


      -course_number (up to 30 repetitions)

      -earned_cr_hrs (up to 30 repetitions)

      -grade (up to 30 repetitions)

      -gpa_points (up to 30 repetitions)

      mult_poins_potential = calculation (gpa points * earned cr hrs)

      I need the total sum of mult_points_potential (of all 30 repetitions(repetition 1+ repetition 2, etc)). Is there a way to get that?

        • 1. Re: Sum question

          Ick, repeating fields! 98% of the time, you are better off replacing them with a table of related records where each related record takes the place of one repetition.

          I assume you want the total gpa * the total earned cr hrs.

          Sum ( gpa_points ) * sum ( earned_cr_hrs )

          Sum will add up the repetitions when the field in the parenthesis is a repeating field.

          • 2. Re: Sum question

            Thanks for the answer Phil. I did what you told me. Created two tables, one student info, the other course info. They are now related records.

            I used the formula you gave me, but the result is earned_cr_hrs * gpa_points. I need the sum of all 30 related records (mult_points_potential).

            Thanks again

            • 3. Re: Sum question

              The sum function works both with related records and repeating fields.

              In your student info table define this calculation:

              Sum ( Course Info::earned_cr_hrs ) * Sum ( Course Info::gpa_points)

              Or, you need to sum the product of these two values,

              Define a field that calculates: cr_hrs * gpa_points in Course info and define the sum calculation in Students to compute the sum of this calculation field.

              • 4. Re: Sum question


                Thank you very much.