Metric Expression Editor for derived metrics

You can create new metrics (called derived metrics) based on attributes and metrics that have already been added to a dashboard or document. For a more detailed description of derived metrics in dashboards, see Creating a metric based on existing objects: Derived metrics.

You can use the Metric Expression Editor to create a derived metric from scratch, which allows you to customize the metric and make it more sophisticated to fit your needs. Steps to create and edit a metric are provided below.

 

Use the Metric Expression Editor to:

To create a metric, you must define the metric's formula, which consists of arithmetic operators (+, -, *, and /) and functions. The operators and functions can be applied to attributes or metrics.

To add functions to the metric formula, you must select any options required to define the function. For example, if you want to add a grouping function, such as Sum, Average, First, or Maximum, you must define the function's expression, and you can also change the attribute level that the metric aggregates at. If you want to add a non-grouping function, such as data mining, date, and ranking functions, you must define the input values (called arguments) for the function, as well as any parameters you can use to determine the behavior of the function.

For a dashboard, you can create a derived metric and immediately display it on a visualization, or you can create and add a derived metric to a dashboard without adding it to a specific visualization. Both methods add the derived metric to the list of dataset objects in the dashboard's Datasets panel, so that you can use the metric in visualizations, text fields, and so on.

For a document, you can create a derived metric and immediately display it on a Grid/Graph, or you can create and add a derived metric to a document without adding it to a specific Grid/Graph. Both methods add the derived metric to the list of dataset objects in the document's Dataset Objects pane, so that you can use the metric in Grid/Graphs, data fields, and so on.

Follow the steps below to create sophisticated derived metrics from scratch, using attributes, metrics, functions, and arithmetic operators.

If you want to create a metric by selecting objects and being guided through the process, and the metric that you want to create does not include custom expressions, click Switch to Function Editor, then see To create a basic derived metric.

Prerequisites

To create a derived metric from scratch:

  1. Click the name of the dashboard or document to open it.

  2. Do one of the following:

The Metric Formula Editor opens.

  1. Type a name for the metric in the Metric Name field.

  2. In the editor pane to the right, begin typing the metric formula.

  1. To add a dataset object to the metric, from the Objects list, double-click the name of an object to add it to the editor pane. You can narrow down the list of dataset objects displayed by typing the name of the object in the search field, or by selecting a specific category of dataset object from the drop-down list, as follows:

  1. To add a function to the metric, perform the following steps:

  1. From the Functions list to the left, browse to and select the function to use to create the derived metric.  You can filter the list of functions displayed by typing the name of a function in the search field, or selecting a function category from the drop-down list. You can click Details at the bottom of the dialog box to see a description of the function, examples, and syntax information.

  2. Hover the cursor over the name of the function, then click Edit.

  3. If you selected an aggregation function (also known as a grouping function), such as Sum, Average, First, or Maximum, the Expression field is displayed, along with settings for defining the level. Perform the following steps:

  1. Type the function expression in the Expression field. As you type, matching objects are displayed in a drop-down list. You can click an object or continue to type. You can type multiple objects, such as Revenue-Profit.

  2. If the Function Parameters icon is displayed, you can define function parameters, such as whether to use all values in the calculation or to calculate using only the unique values. Click the Function Parameters icon . Select the appropriate options to define each parameter, then click OK to apply your changes. For a list of the function parameters for a specific function, click Details at the bottom of the dialog box.

  3. By default, the function is calculated at the level of the attributes on the visualization, Grid/Graph, or document section on which the metric is placed. You can specify the attributes to use in the metric calculation, regardless of where the metric is placed. To change the level, select an attribute from the Level drop-down list. You can add multiple attributes.

  4. If you selected a non-grouping function, such as data mining, date, and ranking functions, you are presented with options to define the input values (called arguments) for the function, as well as any parameters you can use to determine the behavior of the function. To view a list of the arguments and parameters for the function, click Details at the bottom of the dialog box.

For example, the NTile function has two parameters, Ascending and Tiles. Ascending controls whether the NTiles are ordered in ascending or descending order, while Tiles sets the number of splits.

Perform the following steps:

  1. For each argument listed, type a value to use as input values of the function.

  2. For each parameter listed, type a value or select the parameter value from the drop-down list.

  3. When finished, click Add to add the function to the metric. The function, including the arguments you provided, is displayed in the editor pane.

  1. Repeat the appropriate steps above as desired to define your metric formula. For example, you can add another metric, operator, or function to the formula. To delete the metric formula and begin again, click Clear All.

  2. When you have completed the metric formula, click Validate. The Expression Editor displays a status message below the metric expression, indicating whether or not the new metric expression is correct. When the message displays as Valid Metric Formula, the metric expression is correct.

  3. By default, the aggregation and subtotal behavior is automatically determined. You can change the behavior, to specify whether the derived metric is calculated using the whole dataset or calculated using the data in the visualization or document section that it is placed on. For an explanation of when you need to change the behavior, and steps to do so, see Changing the aggregation and subtotal behavior for a derived metric.

  4. When finished, click Save to save your changes. Your derived metric is created and added to the dashboard or document.

Performing conditional calculations: If and Case functions

Conditional calculations can be used to supplement the conditional analysis provided with filtering and thresholds. For example, you can provide conditional analysis by combining data into different groups based on the value of one or more metrics in a dashboard or document.

Prerequisite

You must have Edit Dashboard and Run Dashboard privileges.

 

To perform conditional calculations with derived metrics:

  1. Click the name of the dashboard or document to open it.

  2. From the Datasets or Dataset Objects panel, right-click the dataset to add the metric to, and select New Metric. The Metric Formula Editor opens. Note: IFrom the Datasets or Dataset Objects panel, right-click the dataset to add the metric to, and select New Metric. The Metric Formula Editor opens.

  3. Type a name for the metric in the Metric Name field.

  4. From the Functions list to the left, browse to and select the If or Case function to use to create the derived metric.

  5. Hover the cursor over the name of the function, then click the pencil icon. The options to define the input values (called arguments) for the function are displayed. To view details of the arguments for the function, click Details at the bottom of the dialog box.

  6. Type the values to use as arguments, as described below:

  1. When finished, click Add to add the function to the metric. The function, including the arguments you provided, is displayed in the editor pane.

  2. Click Validate. The Formula Editor displays a status message below the metric expression, indicating whether or not the new metric expression is correct. When the message displays as Valid Metric Formula, the metric expression is correct.

  3. When finished, click Save to save your changes. Your derived metric is created and added to the dashboard. You can now add the derived metric to a visualization, as described in About visualizations.

Related topics

Metric Function Editor for derived metrics in dashboards

Creating a metric based on existing objects: Derived metrics

Editing or deleting derived metrics in a dashboard

Creating a filter for the data on a visualization

Thresholds Editor for dashboards

 

 

_____________________________