Running Total Fields Feature in Crystal report

By | October 29, 2024

Crystal report is an application used to create custom reports from a various of data sources. It includes major features such as formulas, cross-tab reports, sub-reports, special fields, conditional formatting and running total fields etc.
Running totals are essential in reports where you need cumulative calculations, such as financial reports, sales tracking, or inventory summaries. Crystal Reports offers a built-in feature for running totals, allowing you to easily calculate totals that update dynamically as your report progresses.
A running total is a cumulative calculation that updates progressively with each row or group in your report.
Recently, we had a requirement from one of our client who wanted a sales register detail report. In this report, the data would be listed line by line. However, there is one column for the total amount, where the amount should appear only once. For example, if there are three lines in a sales invoice, all three lines will appear, but the amount will show only on the first line. Additionally, they want the total grouped by customer.

To achieve the above requirement follow the below steps:

To suppress the amount field in Crystal Reports when the invoice number repeats, follow these steps:

1)Right-click on the amount field you want to suppress and select “Format Field”.
2)Go to the “Common” tab in the Format Editor.
3)Next to the “Suppress” checkbox, click the formula button (the “X-2” symbol) to open the to open the Formula Editor.
4)Use the following condition to check if the invoice number is the same as the previous record:

New Stuff: Simple way to Implement Container tracking in Sage X3

Figure 1- Format Formula Editor - Suppress
Figure 1- Format Formula Editor – Suppress

Replace {Command.Document Number} with the actual field name from your database that holds the invoice number.
5)Click “Save and Close”.

This condition will suppress the amount field when the invoice number is the same as the previous one, ensuring the amount appears only once for repeated invoice numbers.
To prevent the suppressed amount values from being included in the sum calculation in the footer, you can use a conditional

running total instead of a simple summary field. This way, the sum will exclude the suppressed values. Here’s how to do it:

Steps to Create a Conditional Running Total:

1)Insert a Running Total Field: Right-click on the “Running Total Fields” in the Field Explorer and select “New”.
2)Give the running total a name (e.g., ” sum_of_invoice value”).
3)Set the Field to Summarize: In the Field to summarize dropdown, select the amount field (e.g., ‘@invoice value’
4)Set the Type of Summary: Choose Sum from the available options.
5)Add a Conditional Evaluation Formula: In the Evaluate section, choose “Use a formula”, then click the formula button to enter a formula that will prevent summing the suppressed amounts.

Figure 2- Conditional Evaluation Formula
Figure 2- Conditional Evaluation Formula

6)Reset: In the Reset section, choose how to reset the running total. Typically, you’d reset it per group (if grouping by invoice number) or at the end of the report, depending on your report structure.
7)Place the Running Total Field: Insert the running total field in your footer section where you want the sum to appear. Refer the below screenshot for your reference.

Figure 3- Running Total Fields
Figure 3- Running Total Fields

This will ensure that the suppressed values are not included in the sum, and you will get the correct total in the footer.

In the below screenshot you will get desired output –

Figure 4- Output
Figure 4- Output

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business ManagerSage CRM Project ManagerSage CRM Resource PlannerSage CRM Contract ManagerSage CRM Event ManagerSage CRM Budget PlannerGmail IntegrationSage CRM Mobile Service SignatureSage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.