An Invoice Rule Entry Criteria can be set up to use an aggregate function to support computations that perform calculations such as counting records, summing values, and finding min and max values.

The **aggregate** functions allow you to compute totals based on specific criteria within various objects. Their behavior and applicability vary depending on the chosen Existing Object from your Rule Entry Criteria. Supported Aggregate functions are COUNT, SUM, MIN, and *MAX*.

Below is a detailed explanation of how Aggregate functions operate for different objects and scenarios:

## Aggregate Functions Behavior by Existing Object

### Account

- Aggregate functions are computed
**per account**. -
*For example,*they calculate the SUM of all line items for each account and group and sum the totals per account. - Criteria for these aggregate functions can be evaluated against an existing object
**field**only. **Value-based evaluations**for the aggregate are not supported here.

### Matter, Budget, or Budget Detail

- Aggregate functions compute
**per matter**. -
*For example,*they calculate the SUM of all line items for each matter and group and sum the totals per matter. - Criteria for these aggregate functions can be evaluated against an existing object
**field**only. **Value-based evaluations**for the aggregate are not supported here.

### Invoice or Invoice Line Item

- Aggregate functions compute for the
**uploaded invoice only**. -
*For example,*they calculate the SUM of all line items in the uploaded invoice. - Criteria for these aggregate functions can be evaluated against an existing object
**value**only. **Field-based evaluations**for the aggregate are not supported here.

### Rate

- Aggregate functions are
**disabled**when a rate is selected as the existing object.

## Additional Considerations

- When aggregate functions are added to an invoice rule entry as criteria, any additional rule entry criteria within the rule entry will be applied to compute the aggregate function.
- Aggregate function-based criteria are not numbered. Thus, it cannot be part of the
**Advanced Rule Logic**.