Creating a summary field in Template Editor
When you to want sum value field values in a summary field rather than outputting individual value fields on their own line, you can turn a value field into a summary field.
Do the following:
If you want to print the number of combined output lines, add a value field with the attribute "NUMBER". If you do not want to combine lines but rather output each line and a summary row with an intermediate sum after them, we recommend that you use the Sum value field function to calculate the sum.
See also
Modifying the sort type of a row in Template Editor
Get a single piece of data from the database in Template Editor