# Insert Calculation

'Insert Calculation' lets users calculate and display new categories in a table. New categories can only be calculated on variables that are already added to a table.

The following calculations are currently available:

- Add
- Aggregate
- Subtract
- Multiply
- Divide
- Percent
- Percent of total
- Average
- Percent growth

## Creating a new calculation

To calculate new categories, click on its box above the table and select your preferred method in the 'Insert calculation' submenu. A new window will appear, and depending on the type of calculation you will be able to find the categories to be calculated on.

Select the categories you wish to add to the calculation by ticking off the checkbox next to its name. You can also use the search box at the top to narrow down the list of candidates. This is handy when a variable has many categories.

Next to the search box there are four convenience tools. These can be used to:

- Collapse all sub trees in the list.
- Expand all sub trees in the list.
- Mark all categories as selected.
- Deselect all categories.

Below the list of categories you can add a constant to the calculation and you can define the number of decimals you wish to display.

Before clicking OK, give the new calculation a name in the 'Label' field at the bottom.

Once the calculation is saved, the analysis will be rerun and the calculation will appear in the table.

The calculated category supports drill down, so clicking its name in the table will show a table where only the categories included in the calculation are shown.

### Use of 'Aggregate'

Where cells contain 'average' values, the aggregate function 'aggregates' the values of two or more cells to create an aggregated average.

The formula used to calculate the new aggregated value takes into account the characteristics of the selected measure, e.g. the sum and count values of the average cell. However, 'Aggregate' can be used for aggregating sum/count values. In this case the result will be the same as for the 'Add' function.

### Notes

Calculations that include missing values will result in cells which only contain missing values.

## Editing and deleting calculations

Calculations can be edited by clicking the variable box above the table and go to the 'Calculations' submenu (note: this submenu is only visible when there are available calculations). Click the 'Edit' entry corresponding to the calculation you wish to edit, and the same window as when creating the calculation will appear. Once you havev made your changes, click OK to save them.

To delete an existing calculation, go to the same menu and pick the 'Delete' entry of the calculation to delete. You will be asked to confirm before the calculation is actually deleted.

To remove all calculations from a tabular (cube) dataset and return to the default view of the table select . However, selecting this icon when using survey data will clear all information and return an empty table.