> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculated measures

> How to create, edit, rename, and delete calculated measures in Atoti UI using the fx+ button in the data model, including MDX templates, the Save and apply workflow, the canUseCalculatedMeasures permission, and how saved calculated measures appear in the data model with the fx icon.

Calculated measures are custom [measures](../navigate-atoti-ui/data-model#measure), often derived from existing measures stored in the [cube](../navigate-atoti-ui/data-model#cube). They can be created on the server, or in the UI.

Saved calculated measures are accessible from the **Measures** section of the [data model](../navigate-atoti-ui/data-model), they can be recognized by the ***fx*** icon before their name. They can be added to a [widget](../create-a-dashboard/widgets/about-widgets) in exactly the same way as other measures, see [add fields to a widget](../create-a-dashboard/widgets/add-fields).

Calculated measures created and saved with Atoti UI are usable in Excel.

<Note>
  To be able to create or modify calculated measures within the application, you
  must have the [**canUseCalculatedMeasures**
  permission](../../developer-guide/customize-atoti-ui/permissions).
</Note>

## Create a calculated measure

To create a new calculated measure from the UI:

* In the data model, in the header of the **Measures** section, click the **"*fx +*"** button. This will open the **Create a calculated measure** popover.
* Enter a name for your calculated measure in the text box.
* Just below, you will see several buttons, each representing a different type of calculated measure. Click one of these buttons to add a template to the MDX editor below.
* A hint is displayed above the MDX editor telling you what is needed to complete the template, depending on which type of calculated measure you have chosen. Click a measure and/or hierarchy from the data model, to add them into the template.
* Alternatively, you can use the MDX editor to type or paste your own calculated measure expression.
* Click **Save and apply** when you are happy with the calculated measure expression and it will be saved to the cube as well as be added to the widget.
* Alternatively, you can click on **Save** and the calculated measure definition will be saved to the cube but not added to the widget.
* The saved calculated measure will now appear directly in the [**Data model**](../navigate-atoti-ui/data-model), and can be added to any widget.

Calculated measures can also be added to a widget by modifying the MDX query directly using the **Query** tab, if it is [included](../../developer-guide/customize-atoti-ui/customize-the-dashboard/manage-the-tool-panel/configure-the-tool-panel) in your application.

<Tip>
  Click the green or red arrow buttons on the bottom left of the popover to increase or decrease the number of decimal places that will be displayed for your new calculated measure by default. Toggle the **"%"** button to choose whether or not the value is displayed as a percentage.

  The format of the value can be changed from the [**Style tab**](../create-a-dashboard/widgets/style-a-widget/edit-the-style-of-a-widget#format-values) after creation, for an individual widget.
</Tip>

## Edit a calculated measure

To edit a calculated measure:

* You can right-click on the measure in the **Data model** and select **Edit \{measure name}**.
* Use the MDX editor to make any changes to the calculated measure expression, then click **Save**.

## Rename a calculated measure

To rename a calculated measure:

* In the data model, right-click the name of the calculated measure to open the context menu.
* Select **Edit \{measure name}**.
* Change the name in the top input box under **Calculated measure name**.

Saved calculated measures cannot be renamed for individual widgets, they can only be renamed globally from the data model.

<Warning>
  Renaming a saved calculated measure will cause errors in dashboards where a
  widget refers to this calculated measure.
</Warning>

## Delete a saved calculated measure

* In the data model, right-click the name of the calculated measure to open the context menu.
* Select **Delete \{measure name}**.
* A popconfirm will apppear asking if you want to continue, if you do, click **Delete**.

<Warning>
  Deleting a saved calculated measure will cause errors in dashboards where a
  widget refers to this calculated measure.
</Warning>
