---
title: "Column group calculation with Advanced Table Viewer macro"
canonical: "https://support.appfire.com/space/TBL/3219587079/Column%20group%20calculation%20with%20Advanced%20Table%20Viewer%20macro"
format: markdown
---
> Macro (aura-html)

The Advanced Table Viewer macro enables you to perform column calculations and display summarized values at each level of the nested group.

## Group calculation overview

Group calculation supports the following calculation types: Sum, Average, Minimum, Maximum, Count, and Distinct. For each group, the macro calculates a summarized value from its nested groups and displays it in each grouped row.

- To apply group calculation, you must first group the required columns. Refer to [Group columns with Advanced Table Viewer macro](https://appfire.atlassian.net/wiki/spaces/TBL/pages/3211755580).
- You can configure only one group calculation type for each ungrouped column.
- For grouped columns, only column-level calculations apply.
- You can configure group calculation only in macro setup mode. You cannot change it in Confluence page view and edit mode.
- The macro displays the configured values in the Confluence page view and edit mode.

![Edit group calculation dialog showing Sum-up type options.](media://b99d6a72-b454-4355-bd4a-a64a3877f888)

## Manage group calculations

> Macro (refined-tabs)
> 
> > Macro (refined-tab)
> 
> You can perform the following group calculation.
> 
> | **Type** | **Description** | **Column type** | **Indicator on the Confluence page** |
> | --- | --- | --- | --- |
> | None | Disables the sum-up calculation - no value is displayed for the column | Any | Not applicable |
> | Sum | Calculates the total of all values in the column | Numeric | Sum |
> | Average | Calculates the average of all values in the column | Numeric | Avg |
> | Minimum | Returns the lowest numerical value in the column | Numeric | Min |
> | Maximum | Returns the highest numerical value in the column | Numeric | Max |
> | Count | Counts the total number of non-empty cells in the column | Numeric, String, Date | Cnt |
> | Distinct | Counts unique values only, ignoring duplicates and empty cells | Numeric, String, Date | Disct |
> 
> 
> > Macro (refined-tab)
> 
> Follow the steps to configure group calculation for any column.
> 
> > 📝 You need edit permissions to access the macro setup mode.
> 
> 1. Edit the macro to open setup mode. Refer to [Set up the Advanced Table Viewer macro features](https://appfire.atlassian.net/wiki/spaces/TBL/pages/1765147138).   
> Each column displays an *Edit column *(  ) option.
> 2. To set up the group calculation for any column, navigate to **Edit column** > **Edit group calculation**.
> 3. For example, to apply group calculation to the **Unit Price** column at the **Category** level:
>   1. First, group the **Category** column. Refer to [Group columns with Advanced Table Viewer macro](https://appfire.atlassian.net/wiki/spaces/TBL/pages/3211755580).
>   2. Then, navigate to column **Unit Price** > **Edit column** > **Edit group calculation** and select **Average**.
>   3. The macro calculates the average from the product rows within each group and displays it on every category group row.
>   4. You can further apply grouping on the required columns and nest groups. The average unit price rolls up and displays at all group levels.
>   5. You can configure group calculation for multiple columns. For example, applying **Minimum** to the **Stock Qty** column displays the minimum stock quantity at all group levels.
> 
> > ℹ️ - Group calculation do not affect the configured column-level calculation type. For example, if you set **Maximum** as the column-level calculation for Unit Price and **Minimum** for Stock Qty, these values remain unchanged when you apply or remove group calculation.
> 
> 
> > Macro (refined-tab)
> 
> 1. To disable group calculation for any column, navigate to the **Edit column** > **Edit group calculation **and select **None.**
>   - For example, to disable the group calculation for the **Stock Qty** column:
>     - Click the **Stock Qty** Edit column. The **Edit group calculation** dialog opens.
>     - Select **None**, and click **Save**.
> 2. To disable group calculation for all columns in the table, edit the macro and click **Disable grouping** ( ).