> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# GrandTotal

> Use the Sigma GrandTotal function to return the grand total for all records in a column based on a provided aggregate formula.

The **GrandTotal** function returns the grand total for all records in a column based on a provided aggregate formula. GrandTotal is shorthand for **Subtotal(aggregate, "grand\_total")**.

## Usage notes

* The **GrandTotal** function can be used to return a summary aggregation for a column in each row of the column. For example, in a table with a column `[Number of Orders]` containing the number of orders per customer, you can use the formula `GrandTotal(Sum([Number of Orders]))` to repeat the total number of orders for all customers in each row. You can contrast this with `Sum([Number of Orders])`, which returns the number of orders per customer. This can be used to make comparisons between each customer and the overall total.

## Syntax

`GrandTotal(aggregate)`

Function arguments:

* **aggregate** (required) - The [aggregate](/docs/aggregate-functions) formula to use in the function.

* Examples: `Count(), Sum([Sales Amount])`

## Example

In a chart visualizing order counts per Product Type and Region, you can add a calculated column with the formula to the tooltip:

```
GrandTotal(CountDistinct([Order Number]))
```

 To see an overall total count of distinct orders across all categories.

* The calculation is shown in the tooltip in this example, but can be used anywhere an aggregate formula is allowed.

  ![The function GrandTotal(CountDistinct(\[Order Number\])) is used in a tooltip for a trellis bar chart. A user can now compare the total for each group to the grand total when hovering](https://files.buildwithfern.com/sigma.docs.buildwithfern.com/a1dc7cf164a6a1f04fff03e63c5db37ec9f99332e76a7ab24df047112e598423/assets/docs-images/9ff429d-GrandTotal.png)

## Related resources

* [Subtotal](/docs/subtotal)
* [PercentOfTotal](/docs/percentoftotal)