The Sample Template Event Ticket shows you, how to use the group calculator in order to calculate sums/AVG/min/max/rownumber/count and much more directly in your data map.
For this example, you will need:
Word 2007 and newer
Your installed and activated dox42 Enterprise Add-In (release 3.4 or higher)