# Calculations

You can add calculated values into Text elements or Table cells by writing a data field name or an expression inside square brackets.

### Single data field lookup

`The client's name is [ClientName].`

### Aggregate functions on grouped data

`There are [COUNT(ClientID)] clients.`

`The total amount is [SUM(Amount)].`

These aggregates will be computed across the current set of grouped rows. Therefore, they are usually used in Text elements in group header or footer sections, report header or footer sections, or table footer rows.

### JavaScript expressions

`There are [Quantity] items at [UnitPrice] each, for a total of [=Quantity * UnitPrice].`

JavaScript expressions must begin with an equals sign (=).

See Functions for the list of available aggregate functions.

### Formatting a calculation within a text element

`The subtotal is [=FORMAT(Quantity * UnitPrice, '$#,##0.00')].`

More information about `FORMAT`

and other functions is available at Functions.

## Syntax rules

Single data field names and aggregate functions can be written without a leading equals sign. All other expressions must begin with an equals sign.