# Insert formula rows

In your planning sheet, you may occasionally need to perform calculations with row values. Formula rows let you calculate values based on other rows in the report. Define formulas by referencing existing rows and applying functions.

The planning sheet has an intuitive formula editor where you enter the row formula. The Excel-like engine supports multiple functions (logical, mathematical, and more) and provides features such as autocomplete, syntax help, and multi-line editing to simplify formula creation and troubleshooting.

{% hint style="info" %}
For more information, see [formula syntax](/planning-sheets/formula-syntax.md).
{% endhint %}

In this article, you learn how to insert formula rows and configure their properties.

### Insert a formula row

1. Select the row above which you want to insert a new row.
2. Go to **Planning** > **Insert Row** and then select **Formula**, or select the row gripper and select **Insert** > **Formula**.
3. In the **Calculated Row** panel, enter a title and define the formula, then select **Create** to insert the row.

<figure><img src="/files/quB2dlWlVwxTiEXYQioS" alt="" width="375"><figcaption></figcaption></figure>

{% hint style="warning" %}

#### Note

The **Create** option is enabled only after a valid formula is entered.
{% endhint %}

You can also create parent rows as calculated rows. To edit or further configure the calculated row, select the edit icon on the row.

<figure><img src="/files/kkSOuG2Ofjgma42HWcCV" alt=""><figcaption></figcaption></figure>

### Formula editor

The formula editor provides features to help you create and manage formulas efficiently:

* **Functions** tab: View the list of available functions.
* **Autocomplete (IntelliSense)**: Enable the **Suggestions** toggle to see function and reference suggestions as you type.

<figure><img src="/files/LfsdEaQScA0Tx5DSBtGX" alt="" width="375"><figcaption></figcaption></figure>

* **Syntax help**: View function syntax, arguments, and examples for better understandability and quick reference.

<figure><img src="/files/cLQCT3R32bMaogUnbGOZ" alt="" width="375"><figcaption></figcaption></figure>

* **References**: Insert references to existing rows using any of these options:
  * Select a row directly from the report while the cursor is in the formula editor.
  * Use the **References** tab to search and select values based on hierarchy.

<figure><img src="/files/veBmr7o3GKSneKIQOpHC" alt="" width="375"><figcaption></figcaption></figure>

* **Expanded editor**: Use the expand option to open the **Maximized Formula View** with line numbers and detailed error messages for easier debugging.

<figure><img src="/files/Wax3WcojJ1bhUUvj1EYo" alt=""><figcaption></figcaption></figure>

### Configure formula row properties

Common properties of calculated row can be configured by specifying **Row Type**, **Insert As**, **Scaling Factor**, and **Include in total**. For more information, see [row properties](/planning-sheets/how-tos/adding-business-logic-and-formulae/rows/insert-manual-input-rows.md#data-input-row-properties).

In addition to these, you can configure the following settings for calculated rows:

* **Evaluated Formula For**: When a formula row intersects with a formula column, you can control how the column formula is applied.

  * **All Data Source and Input Columns:** Applies the formula to all relevant columns, including measures assigned to Values (AC), data input columns, and forecast columns.
  * **All Columns:** Applies the formula across all columns in the report, regardless of the type.
  * **Custom:** Allows you to selectively include or exclude column formulas. To configure, select **Custom** > **Configure** > **Include**/**Exclude** > **Save.**

  In the following example, the *Plan - ACME* column is included for the *Packaged Water* row.

<figure><img src="/files/C6JhGvro9TZIKAVX88tj" alt=""><figcaption></figcaption></figure>

* **Bind for cross filter/RLS**: Enable this option to ensure that cross-filter selections and row-level security (RLS) rules are applied to calculated rows.

  * **Bind using a row**: Select **Selection Type** as **Row** and choose a reference row to restrict visibility based on its data. In the following example, the *Mocktails* row references the *Juices* row. After binding, the *Mocktails* row is visible only to users with access to *Juices* data.

  <figure><img src="/files/eyozprYktd48a3bXHAb3" alt="" width="375"><figcaption></figcaption></figure>

  * **Bind using a dimension member**: Select **Selection Type** as **Dimension Member** and choose a dimension to control access. In the following example, the *Baked Items* category is bound to the *Beverages* category. As a result, *Baked Items* is visible only to users with access to *Beverages.*

<figure><img src="/files/jmJnlpVljCj6yDYKRXaC" alt=""><figcaption></figcaption></figure>

* **Adding a description:**  Optionally add a description to provide context for the formula.

{% hint style="warning" %}

#### Note

The **Custom** option in **Evaluated Formula For** is enabled only when applicable columns or measures are available for evaluation.
{% endhint %}

### View and manage formulas

* Select a cell in the calculated row to preview the applied formula in the formula bar.
* Use the **row gripper** to edit or delete the row as needed.
* Or go to **Insert Row > Manage Rows > Rows**, hover over the created row, and choose the appropriate action through icons.<br>

<figure><img src="/files/tNd8DH535ojUu6GXp2FQ" alt="" width="375"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fabricplan.com/planning-sheets/how-tos/adding-business-logic-and-formulae/rows/insert-calculated-rows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
