Calculate Fields

Calculate Fields Manual · Chapter 5

Description of the Calculate Fields in Vtiger CRM

The Calculate Fields module provides calculating values for Numbered fields or Date fields. This calculation for particular fields is based and provided on fields of related modules and defined filters for these modules.

In order to define a calculation for field in the target module you have to provide following steps:

  1. Define / select the field which value will be calculated in the target module.
  2. Define the filter (custom view) for the related module.
  3. Define the calculation within Calculate Fields settings.

The only new step from above approach is number 3. The others are the standard Vtiger CRM functionalities.
Please refer to the online Vtiger CRM manual, web pages, forums to obtain more details for example:

5.1 Setup calculation of the Calculate Fields

The Calculate Fields settings you can find under:

Menu → CRM Settings → Other Settings → Calculate Fields

In order to setup calculation provide following steps within settings:

  1. First at all click on How to add Calculate Fields button

    Calculate Fields Setup
    Calculate Fields – New Calculate Field

  2. Select the target module – the target module is the module in which new calculated field is created/located

    Calculate Fields Setup
    Calculate Fields – Select target module

  3. Select the target field – the result of the calculation will be stored/updated in this field
    (icon Setup calculation of the Calculate Fields means, that this field is already filled by Calculate Fields)
    (icon Setup calculation of the Calculate Fields means, that this field is used by Calculate Fields)
    Calculate Fields Setup - Target Field
    Calculate Fields – Select target field

    Or you can reate a new field, so please provide following steps:

    • click on Add custom field button – Setup calculation of the Calculate Fields button
    • select Field Type

      Creating new Custom Field
      Creating new Custom Field

    • choose in which block the new Field will be placed/shown and type required information. click on Save button – Setup calculation of the Calculate Fields
      Creating new Custom FIeld
      Creating new Custom FIeld
    • After Save, new custom field is created

      Vtiger Custom Field
      New Custom field

  4. Next click on Edit Edit icon icon for already created Custom field

    Selecting target field in Calculate Fields
    Selecting target field in Calculate Fields

  5. Select related module – you can select only from the group of related modules (visible also within “More Information” tab), you can also add Description and click on Next button – Setup calculation of the Calculate Fields
    Choose Source Module
    Choose Source Module
  6. Select related module filter/custom view or you can create a new custom view – calculation is done using only group of related records which fit to filter conditions. Continue by Next button – Setup calculation of the Calculate Fields
    Selecting/creating a filter
    Selecting/creating a filter
  7. A) Select column – Select column/related field – there should be a list of available columns from related module and the list depends on the type of related module.
    You have to select one column according to your needs, e.g. Invoice you can select from: Adjustment, Sub Total, Total, Discount Amount and more.B) Select operation – we provide operations like:
    SUM (value1+value2+…+valueN)
    AVG (SUM/COUNT)
    MIN (minimal value from all values, i.e. value1 …valueN)
    MAX (maximum value from all values, value1 …valueN)
    COUNT (the count of the values, i.e. N)
    Selecting column and operation
    Selecting column and operation
  8. Your Calculated Field is created/edited now

    Your Calculate Fields
    Your Calculate Fields

  9. New column (Grand Total of All Invoices) is empty until first start of Calculate Field’s Scheduler

    Vtiger Calculating Fields preview
    Calculated Fields results

5.2 Setup of Scheduler

As was before mentioned, the calculations provided for Calculated Fields are done automatically based on scheduler settings and cannot be initiated manually.

Please check the scheduler settings,i.e. check whether the status for Calculate Fields is “Active”.

If not, please change it via Edit Edit icon icon, as well as define frequency as shown in the picture below:

Setup of Scheduler Recommended frequency for Calculate Fields 4 you is 1 day

Calculate Fields – Scheduler
Calculate Fields – Scheduler

5.3 AfterSave (instant calculation)

Since August 2021 we also support AfterSave calculations

This is included in version 4.5 and higher

AfterSave (instant calculation) What is a AfterSave calculation?

The the calculations will be made immediately after saving the record.

For example:

We have an Organization where in the Annual Revenue field, there should be a SUM of all Paid Invoices assigned to the given organization.
So now when you create or edit any Invoice related to this Organization, the Annual Revenue will be instantly recalculated after you press Save button when editing or creating an Invoice.

This setup you can find when creating or editing Calculated Fields in step 3 – Operation:

calculated fields instant calculation
AfterSave – Instant calculations

Need help with Calculate Fields?

Our support team answers questions about installation, templates and settings.