Expression Editor

You can use the Expression Editor to manage the Functions used for the Aggregation of the Measures. Measures are parameters that are used to define analytical data that are visualized in the Charts, Rollups, and Actionable Insights. The Expression Editor provides a graphical user interface that helps you create and edit the Functions.

See the complete list of the available expressions Datamart Query Expressions.

Create Measure

To create a new Measure directly from the list of pre-defined aggregation types follow these steps:

Rollups

  1. Go to Analytics > Rollups > Rollup Settings > Measures > Add Measure.

  2. Select an item from the list.

  3. Click Add Item.

  4. Under Aggregation select the aggregation type.

  5. Click Apply and Refresh.

    How to add Measures in Rollups

Charts

  1. Go to Analytics > Data Analyzer.

  2. Select a Chart type.

  3. Go to Measures > Add Measure.

  4. Select an item from the list.

  5. Click Add Item.

  6. Under Aggregation select the aggregation type.

  7. Click Apply and Refresh.

    How to add Measures in Charts

Edit Measure

You can edit an existing pre-defined Measure using the Expression Editor.

Rollups

  1. Go to Analytics > Rollups > Rollup Settings > Measures > Add Measure.

  2. Select an item from the list.

  3. Click Add Item.

  4. Under the Aggregation click { } Function.

  5. You will be presented with the Expression Editor.

Charts

  1. Go to Analytics > Data Analyzer.

  2. Select a Chart type.

  3. Go to Measures > Add Measure.

  4. Select a Chart from the list.

  5. Click Add Item.

  6. Under the Aggregation click { } Function.

  7. You will be presented with the Expression Editor.

    Edit Measure Expression dialog
    Edit Measure Expression dialog

Expression Editor Description

Expression Editor Item

Description

Measures

You can select from the dropdown:

  • Measure

  • The aggregated value of the Measure (Sum, Avg, Per-Unit, etc.)

Expression Editor only works with the aggregated values. You need to either select an aggregated value directly from the dropdown or specify aggregation later otherwise you receive the following warning: non-aggregated value used.

Operators

Using the following operators you can define a relation between each aggregated value.

  • Arithmetic

  • Logic

  • Compare

  • String

Functions

You are provided with the following function categories that can be used in your expression.

  • General

  • Aggregation Functions

  • Statistical Aggregation

  • Within Groups

  • SQL

Run

You can test your expression to see if you are getting the expected value. The calculated value will be presented in the Result Preview section.

Visual Editor

You can switch between graphical and text representations of your expression. If the expression received by the editor is valid but cannot be represented graphically (a non-renderable expression), the Visual Editor cannot display it in graphical form.
info See Non-Renderable Expressions below for how the editor handles this case.

When you define an expression for your measure you always need to specify a concrete argument otherwise you receive the following warning: Missing argument.

Non-Renderable Expressions

Queries and expressions that are built outside of the Expression Editor's graphical view, for example, directly through the Query API or by a Query Definition used in a Dashboard Portlet, are sometimes valid but cannot be represented in the Visual Editor's graphical mode. This is called a non-renderable expression.

When the Expression Editor receives a non-renderable but valid expression, it no longer fails silently or blocks you from working with the underlying query. Instead, the editor displays a message indicating that the expression cannot be shown graphically and falls back to the text representation, so you can still view and edit the expression. Dashboard Portlets and Query Definitions based on a non-renderable but valid query continue to render their results normally, only the graphical (Visual Editor) view of the expression itself is affected.

If you edit a non-renderable expression in the text view and save your changes, the expression is validated again. If the updated expression becomes renderable, the Visual Editor displays it graphically the next time you open the Expression Editor.

The non-renderable expressions validation is available starting from version 17.1.

Expression Examples

Below you can find the most common expression examples.

Cost per Unit

This is a typical example of an expression that has two aggregated SUM values that are divided.

How To

How To: Cost per Unit

Result

Cost_per_Unit_Result.png
Cost per Unit Expression

Cost per Unit Percentage

How To

How To: Cost per Unit Percentage

Result

Cost_per_Unit_Pctg_Result.png
Cost per Unit Percentage Expression

Average Gross Margin

How To

How To: Average Gross Margin

Result

Average_Gross_Margin_Result.png
Average Gross Margin Expression

Gross Margin Trend

In this example we already have a Watcher defined. We have two Time Series grouped by Country. The Invoice Date Quarter is used as a Dimension Filter. We want to create a Join Series to track the Gross Margin Trend.

How To

How To: Gross Margin Trend

Result

Gross_Margin_Trend_Result.png
Gross Margin Trend Expression

Since the release of Southside 15.1, we have introduced the Label field in Measures. By default, the Label value is automatically generated based on the Measure and Aggregation Formula. For example, if your Measure is Quantity and your Aggregation Formula is , then the Label value will be ∑Quantity. This concept is similar to the Name and Label fields used for Logics and Dashboards. The default Label value can be customized according to user preferences. Labels are displayed in the Data Table Result and will also be utilized in Agents, such as Detection Rules.

See Also