Calculated measures
Calculated measures are custom measures, often derived from existing measures stored in the 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, they can be recognized by the fx icon before their name. They can be added to a widget in exactly the same way as other measures, see add fields to a widget.
Calculated measures created and saved with Atoti UI are usable in Excel.
To be able create or modify calculated measures within the application, you must have the canUseCalculatedMeasures permission.
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 Add to view when you are happy with the calculated measure expression.
- Your calculated measure definition will be added to the query.
Calculated measures can also be added to a widget by modifying the MDX query directly using the Query editor tool, if it is included in your application.
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 editor after creation, for an individual widget.
Save a calculated measure
To save a calculated measure:
- Hover the calculated measure tile in the Content editor, you will see some icons appear on the right of the tile.
- Click the save icon.
- The saved calculated measure will now appear directly in the Data model, and can be added to any widget.
Advanced users may notice the MDX expression in the Query editor is updated when saving a query-scoped calculated measure, to reflect the calculated measure now being saved in the cube.
Edit a calculated measure
To edit an unsaved calculated measure:
- Hover the calculated measure tile in the Content editor, you will see some icons appear on the right of the tile.
- Click the edit icon.
- Use the MDX editor to make any changes to the calculated measure expression, then click Add to view.
To edit a saved calculated measure:
- You must first add it to a widget.
- Follow the same steps as above, to edit an unsaved calculated measure.
- When you click Add to view, the calculated measure expression will be updated for the selected widget only, unless you save your changes.
- If you do save your changes, the updated MDX expression will be used anytime the calculated measure is added to a widget in the future, and widgets already referring to this measure will be updated the next time their dashboard is opened or if the dashboard is reloaded. Refreshing the widget will not update the version of the calculated measure.
Rename a calculated measure
To rename an unsaved calculated measure:
- Hover the calculated measure tile in the Content editor, you will see some icons appear on the right of the tile.
- Click the edit icon.
- Enter the new name in the text box.
- Click Add to view.
Alternatively, unsaved calculated measures can be renamed by modifying the MDX query directly using the Query editor tool, if it is included in your application.
To rename a saved calculated measure:
- In the data model, right-click the name of the calculated measure to open the context menu.
- Select Rename.
- A popconfirm will apppear asking if you want to continue, if you do, click Rename.
- The calculated measure name will become a text input, type the new name and press enter.
- If you need to cancel renaming, press Escape.
Saved calculated measures cannot be renamed for individual widgets, they can only be renamed globally from the data model.
Renaming a saved calculated measure will cause errors in dashboards where a widget refers to this calculated measure.
Delete a saved calculated measure
- In the data model, right-click the name of the calculated measure to open the context menu.
- Select Delete.
- A popconfirm will apppear asking if you want to continue, if you do, click Delete.
Deleting a saved calculated measure will cause errors in dashboards where a widget refers to this calculated measure.