| **Navigation:**  [[clarion 7 faqs.htm|How To's and Troubleshooting]] > How to... >====== How to Create Totals and Calculated Fields on Reports ====== | [[how to create an mdi menu.htm|{{btn_prev_n.gif|Previous page}}]][[clarion 7 faqs.htm|{{btn_home_n.gif|Return to chapter overview}}]][[how to customize your window.htm|{{btn_next_n.gif|Next page}}]] | | || A total field is a variable STRING control with the SUM attribute added. The AVE, CNT, MAX and MIN attributes similarly create averages, counts, maximum, and minimum fields. These attributes may be added by choosing from the **TotalType **drop down list in the **Properties Pad** dialog. In general, you place a total field in a page or group FOOTER, so that it can total the records since the beginning of the report, since the beginning of the page, or since the beginning of the BREAK group. However, you can also place a total field in a DETAIL structure to provide a running subtotal. A tally (CNT) field in the DETAIL can number the records as they appear on the report. To specify a total field, populate a variable string control, then CLICK on the string control and open the **Properties Pad **dialog. Finally, choose a total type from the **TotalType **property** **drop down list. Choose from **Sum, Average, Minimum, Maximum, Count, **and **Page No.** Optionally, use the **Reset **property** **drop down list to reset the total to zero before each page or before each group break. The **Tally** property allows you to specify exactly when the total should increment ' when specific Detail structures print, or when any group break occurs, or any combination of those. **Sub-totals and Page Totals** Sub-totals are created simply by placing a total field within a page or group footer, and reseting the total to zero at the beginning of each page or group. Use the **Reset **property** **drop down list in the **Properties Pad **dialog to reset the total to zero before each new page or group. **Grand Totals** In effect, grand totals are simply totals that never reset. See [[how to print grand totals on a report.htm|How to Print Grand Totals on a Report]] **Row Totals** Displaying a row total (or any other calculation) requires two steps: assigning a value to a variable, then displaying the variable value in a string control (see //Specifying Fields to Print// above). There is a good example of this process in [[lc creating reports.htm|Chapter 12]] of the Learning Clarion section, located in this help file. The assignment may be done with the Formula Editor, or by embedding a hand coded assignment statement. Whether you use the Formula Editor or embedded source, the key point to know is that the assignment should be done just //prior //to the PRINT statement. For formulas, you should choose the **Before Print Detail** class. For embedded source, you should choose the **Before Printing Detail Section** embed point.