Source: https://vaultcrmhelp.veeva.com/doc/Content/CRM_topics/Align/Configuration/CustomRollups.htm

## Using Custom Rollups in Align

Align operational users can create custom rollup metrics for reporting purposes and for display on the Territory Information Panel, enabling displaying any relevant custom rollup metrics.

For example, the Align admin wants to display the total prescription (TRx) sales for Cholecap among Segment A targets. The Align admin creates a Custom Rollup of Cholecap TRx data in the proper territory for Segment A targets and places the field representing the metric on the page layout. Cholecap TRx data now displays in the proper record, so the information is quickly referenced.

**Who can use this feature?**

* Align Operational Users - Browser
* [Creating Custom Rollups](#Creating)
* [Calculating Custom Rollups](#Calculat)
* Users require an Align License

### Configuring Custom Rollups for

[![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)Align Operational Users](#)

To configure this feature, ensure the following features are configured:

* [Configuring Align](ConfiguringAlign.htm)
* [Using the Territory Information Panel](../TerrAssignment/ManageTerr/TerrInfoPanel.htm)

### Creating Custom Rollups as

[![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)Align Operational Users](#)

To create custom rollups, users must first create an appropriate target field on either the aln\_territory\_\_v or aln\_geography\_\_v objects:

1. Navigate to **Admin > Configuration > Objects**.
2. Select either the **aln\_territory\_\_v** or **aln\_geography\_\_v** objects.
3. Navigate to the **Fields** tab.
4. Select **Create**.
5. Select **Number** as the type.
6. Populate the following fields:

   * Field Name
   * Field Label
   * Minimum Value
   * Maximum Value
   * Decimal Places
7. Select **Create**.

Once the target field is created, users must next define the custom rollup rule:

1. Navigate to **Align Admin > Custom Rollup Rules**.
2. Select **Create**.
3. Populate the following fields:

   * Name – Enter the appropriate name
   * Rollup Operator – The following values are available:
   * Sum Distinct – Sum of unique values. Values from duplicate records are ignored.
   * Count Distinct – Count of unique records. Duplicate records are ignored.

     If Count Distinct is selected as the operator, the source\_field\_\_v field automatically defaults to id.
   * Mean
   * Source Object – The following objects are supported:
   * mc\_cycle\_plan\_\_v
   * product\_metrics\_\_v
   * account\_\_v
   * Source Field – Select the appropriate Number-type field on the selected object
   * Target Object – Select the object you created the custom field for
   * Target Field – Select the created custom field
4. Navigate to the **Criteria** section.
5. Add the appropriate criteria for selecting which records are considered when calculating the rollup.
6. Select **Save**.

After the custom rollup rule is defined, users must then add the target field to the appropriate Align Settings records:

1. Navigate to **Align Admin > Align Settings (Production)**.
2. Edit the appropriate record.
3. Add the newly created field to the **Territory Metrics Fields** setting. Use the following format:

   object\_api\_name\_\_v.custom\_field\_\_c
4. Select **Save**.

#### Example: Total Sales Potential of a Territory

For example, the Align administrator wants to create a new rollup metric that represents the total sales potential of a territory. To do this:

1. Create a new Number type field on the aln\_territory\_\_v object named **Total Sales Potential**.
2. Create a new Number type field on the account\_\_v object named **Sales Potential**.
3. Create a new Rollup Rule.
4. Populate the following fields in the Details section:

   * Name – Total Sales Potential
   * Operator – Sum Distinct
   * Source Object – Account
   * Source Field – Sales Potential
   * Target Object – Territory
   * Target Field – Total Sales Potential
5. Populate the following criteria:

   * Criterion 1
   * Field = Is Person Account
   * Operator = equals
   * Value = Yes
   * Criterion 2
   * Field = Specialty
   * Operator = in
   * Value:
   * Cardiology
   * Pediatrics
   * Neurology
   * Oncology
6. Populate the Account Logic field with **(1 AND 2)**.

![](../../../Resources/Images/Align/Configuration/CustomRollups.png)

### Calculating Custom Rollups as

[![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)Align Operational Users](#)

A Custom Rollup metric can be activated and deactivated by selecting the gear icon on the appropriate Custom Rollup Rules detail page.

Metrics recalculate automatically after the following events:

* Pulling from Vault CRM
* Data Loading
* Assignment Preview

The last\_run\_datetime\_\_v field automatically stamps when the metric was last recalculated.

### Related Topics

[Using the Territory Information Panel](../TerrAssignment/ManageTerr/TerrInfoPanel.htm)

[Managing Align Territories](../TerrAssignment/ManageTerr/Territory.htm)

[Managing Geographies in Align](../TerrAssignment/ManageGeo/Geography.htm)
