# Custom formula column

## Overview

A **custom formula column** allows users a new column where each cell's value is dynamically calculated based on a formula. The formula can reference other columns, perform calculations, apply logical operations, or even use built-in functions.

#### Example:

If you have a dataset with columns "Price" and "Quantity", you could create a custom formula column called "Total Cost" that multiplies these two columns, with a formula like:

```mathematica
= {Price} * {Quantity}
```

## Open custom formula column pop-up

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FpISX3NoUqMPos2jZc8AV%2Fimage.png?alt=media&#x26;token=95d0c1b4-d8d6-46fc-af91-93763634a905" alt=""><figcaption></figcaption></figure>

* For Table, you can create a Fx column by clicking on the icon next to the last column.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FI98dKrTVJUcHpJLiwGPj%2Fimage.png?alt=media&#x26;token=da30ceec-b250-4d17-89f4-c3946ed5d404" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FXpBO6sbnfybhTEHI7nwv%2Fimage.png?alt=media&#x26;token=55adc909-69f2-4759-bd8c-dece16f41c06" alt="" width="563"><figcaption></figcaption></figure>

* For other widgets, you can find the Fx icon when adding the column to create a widget.

## Create a custom formula column

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FcLcGOvHrFsZI8Kb1B2js%2Fimage.png?alt=media&#x26;token=3a860677-28d3-464b-8255-fccb18d888c8" alt=""><figcaption></figcaption></figure>

* You will be asked to fill in the Column name and the Formula

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FwL3PnFFlA3R5numzGd0K%2Fimage.png?alt=media&#x26;token=856b72f2-8d32-4a52-a272-9f3add1526db" alt=""><figcaption></figcaption></figure>

* Select the arrows next to Fields and Functions to browse and pick the desired column easily.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2F10w9cYibJK1v7IgZbvjT%2Fimage.png?alt=media&#x26;token=3c82dcb1-49c2-432f-835f-eef1b6ddcaa0" alt=""><figcaption></figcaption></figure>

* You can input directly into the Formula field to display results close to the result.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2F7G28j7rZQN5O73LPUgwO%2Fimage.png?alt=media&#x26;token=654db822-6dab-4bde-83cb-289d3d0a949b" alt=""><figcaption></figcaption></figure>

* Click the Save column button to finish the setup.
* Click the Discard button to go back to the previous state.&#x20;

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FCDngZEA4TvTNUXoh24Hk%2Fimage.png?alt=media&#x26;token=f85b4745-50da-46f5-8843-1b34775564f8" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can check at the bottom of the field to see if the Fx column is aggregated or analytic.
{% endhint %}

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FRtO0yFy3DvHx0LlXBbTL%2Fimage.png?alt=media&#x26;token=df5e00ac-0ac9-427a-aa8d-8dae55d37589" alt=""><figcaption></figcaption></figure>

* The newly create Fx column will be on the right side of the Table.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FsVP6AvcNqzkYc2A5B7MV%2Fimage.png?alt=media&#x26;token=7f5b7b90-1466-41dd-b69e-a7b65c9a4b56" alt=""><figcaption></figcaption></figure>

* For other charts, you can select it on the list.

## Edit a custom formula column

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FJAY09XvG1aWY2zxIG3ST%2Fimage.png?alt=media&#x26;token=b27c0ca5-038d-46e8-b386-1495b98615c0" alt=""><figcaption></figcaption></figure>

* Click on the :pen\_fountain: icon of the Fx column.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2F5kzPhohSUhNxeSr3r9uv%2Fimage.png?alt=media&#x26;token=668ba96d-4138-46bd-9c51-a63f3ffe2720" alt="" width="563"><figcaption></figcaption></figure>

* Click on the Formula text.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FHiKXYLJ2OjJUNEZECGIe%2Fimage.png?alt=media&#x26;token=f5d3e3ad-2710-4b47-b51d-a0d83c5f44b7" alt=""><figcaption></figcaption></figure>

* You can click directly on Properties to edit it.

{% hint style="info" %}
This column is local to the View and won’t impact the data model
{% endhint %}

{% hint style="warning" %}

* In pivot, aggregated/analytical columns can only be used in Values.
* In the vertical bar, the aggregated/analytical column can only be used for the Y-axis.
  {% endhint %}

## Delete a custom formula column

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FRzRt1OP5qUEnHfZbRgcg%2Fimage.png?alt=media&#x26;token=b94038fe-8453-47f1-a857-fb474b1447b8" alt="" width="363"><figcaption></figcaption></figure>

* Simply click the Delete button in the Edit column to delete the Fx column.
