In the calculations menu (), you can create a variety of calculated, or custom metrics and attributes for your reports. One of the metric types you can use is the standard calculated metric. This enables you to write your own calculations, and add customized metrics or attributes to your dataset. Your calculations can include metrics and attributes already in your query and functions from Explore's formula writing language.
For a list of all available calculated metrics and attributes, see Calculation types reference.
This article contains the following sections:
Standard calculated metrics
Standard calculated metrics give you the freedom to create completely new metrics to add to your dataset. You can use pre-existing elements from your dataset and functions from Explore's formula writing language.
To create a standard calculated metric
- In Query Builder, click the calculations icon () on the right sidebar.
- Click Standard calculated metric.
You will be redirected to the formula editor (see Writing Explore formulas).
- If you want to add any metrics or attributes to your formula, choose them from the Select a field drop-down list or select Explore's auto-complete suggestion when manually typing. For more information on including metrics and attributes in your formulas, see Adding metrics and attributes to your formula.
- If you want to add functions to your formula, click the Add button underneath Functions or select Explore's auto-complete suggestion when manually typing. For more information on adding functions to your formula, see Adding functions. For a full list of all available functions, see Formula writing resources.
- Check Compute separately if your formula is using existing calculated metrics and attributes, and you do not want to affect their calculations.
- Click Save.
You can now add your calculated metric to your query. This metric will also be saved to the connection the query was created from.
Standard calculated attributes
A standard calculated attribute is similar to a standard calculated metric. You can use standard calculated attributes to create new, custom attributes to add to your dataset. Standard calculated attributes can use existing attributes and metrics, as well as functions from Explore's formula writing language.
- Computed from: The drop-down list contains all available attributes you can use as a foundation for your standard calculated attribute. This does not include global variables.
- Sort like time attribute: If your calculated attribute represents dates, this option places your date values in the correct order.
Deleting standard calculated metrics and attributes
You can delete standard calculated metrics and attributes from the data structure menu of Query Builder.
To delete a standard calculated metric or attribute
- In Query Builder, open the data structure menu ().
- The menu is split into two columns, Attributes and Metrics. Expand Calculated Attributes or Calculated Metrics as required.
- Choose a metric or attribute, and click the down arrow next to it.
- From the menu, click Delete, then confirm your action.
The metric or attribute you selected will be deleted. Note that this might affect the operation of any queries that use it.