Avoid updating multiple spreadsheet formulas by automating standard calculations and storing them in Cube as a formula. A formula references other dimensions and allows its value to be calculated whenever referenced values are updated.

For example, calculate *Gross Profit* by creating a formula in Cube that subtracts '*Cost of Goods Sold*' from '*Revenue*'

## Add a new formula

1. Go to your Web portal and click **Formulas** or **Dimensions** from the navigation bar.

2. Click **New.**

3. Name your formula.

4. Select a dimension **Parent** from the dropdown menu provided.

The parent you choose is where your formula's data will originate and can be a top-level dimension such as Account.

**Note**: Scenario dimensions with write protection enabled cannot be used in formulas.

Learn more about using formulas with scenarios.

6. Write your **F****ormula** using quotation marks around the dimension names or select the populating dimension name from the suggestion. See the table of operations supported.

The background color will turn green if the text you input matches a Cube dimension. If the dimension name is mistyped, it'll show in red.

7. By default, your new formula is set to apply to **All Scenarios**. Click the drop-down to select a specific scenario, or proceed to step 8.

**Note**: Formulas cannot be applied to the Actuals Scenario, as these dimensions have write protection enabled.

8. Determine your **rollup logic**. Rollup logic determines the calculation order:

- To sum up the components of each quoted dimension and then perform the calculation, select
**Sum leaf values, then calculate** - To first calculate the values across quoted dimensions and then sum it's parts, choose
**Calculate leaf values, then sum**

Learn more about formula rollup logic.

9. (Optional) Select a **rollup account type**: sum, average, or balance

Learn more about rollup account types.

10. Once you've completed each step, click **Save Formula** and you will see the new formula in your dimensions or formulas list.

You can recalculate, edit, or clear a formula any time using the menu icons on the **Formulas** page.

If you want your formula in a particular location, you can re-order the formula from your **Dimensions** page just like any other dimension.