This is a public Forum  publicRSS

Forum post

    jackdash
    Using the Sum function
    Forum post posted October 30, 2009 by jackdash, last edited February 9, 2012 
    1515 Views, 2 Comments
    Title:
    Using the Sum function
    Post:

    I am construting a flat database and would like advice on the following:

    I have a field named Amounts for which I want to have a total at the bottom I thought I would be able to use the Sum function but get the impression that to use Sum I have to enter each field ie Sum(amount1,amount2 etc.)

    Is there a way to sum all the fields without having to enter all the amount fields?

    Answer

     

    • Ninja

      Howdy jackdash,

       

      How many 'amounts' are there?  If there are a large number, you might want to reconsider the "flat" part and use a child table so that there are many records, each one with one "amount"

       

      Then your total could be Sum(Child::amount) and you'd be done with it.

       

      If there are only 2-3 'amounts', simply make your calculation field to be = amount1 + amount2 + amount3

    • PhilModJunk
      Nothing wrong with Ninja's suggestion, but you can also define a summary field to do this and place it in a footer or trailing grand summary to get a total at the bottom of your layout/report.