Optional: Formulas & multi-metrics

Learn to apply calculated metrics to analytics dashboards in your NLX workspace

Why use formulas?

Formulas can be used to convert values (seconds to milliseconds) or combine multiple filtered metrics into one. This enables you to view desired data without the need to looking at several charts and manually perform calculations.

Formulas enable you to add one or more metrics to a mathematical expression to create an entirely new metric. Metrics created through a formula are called calculated metrics. You can reference existing metrics, numbers (1, -2, 4.513) or mathematical constants such as π (pi). Parentheses () can be used to denote the order of operations within your expression.


Supported charts

Be sure to add one or more datasets before applying a formula to your chart.

The following lists all chart types where formulas may be used:

  • Bar chart: Displays formula output as a new bar

  • Line chart: Displays formula output as a new line

  • Table: Displays formula output as a new column


Basic arithmetic functions

The following lists the basic arithmetic functions supported; x, y represent constants or metric references:

Operation
Usage
Examples

Addition

+

1+1 {SampleMetric}+1

Subtraction

-

10-8 {SampleMetric}-20

Multiplication

*

2*3 5*{SampleMetric}

Division

/

1/2 1/{SampleMetric}

Unary subtraction

-x

-1 -{SampleMetric}


Math functions

The following lists the mathematical functions that are supported:

Operation
Usage
Examples

Absolute value

abs(x)

abs(-1) abs({SampleMetric})

Square root value

sqrt(x)

sqrt(4) sqrt({SampleMetric})

Ceiling function

ceil(x)

ceil(1.67) ceil({SampleMetric})

Floor function

floor(x)

floor(3.2) floor({SampleMetric})

Power function

power(x,y)

power(2,2) power({SampleMetric}, 10)


Using formulas

To add a formula to a Bar chart, Line chart, or Table:

  1. Select an existing Analytics dashboard or + Add new. If choosing an existing dashboard, hover beside the dashboard name to select the edit option

  2. Select + Add panel > Hover over panel > Click the edit icon

  3. Select + Add dataset or + Add data column; Repeat as needed

  4. Choose + Add formula or + Add formula column > Enter a name

  5. Formula: Enter the mathematical function. To reference an existing metric, type an open curly bracket { that displays a list of available metrics to reference

  6. Formula unit: Choose how the calculated metric is displayed. For example, if your formula outputs a percentage, you can select the Percentage option from the dropdown to display a percent % character next to your numerical output

  7. When done, click Save

Referencing a calculated metric into another formula input is unavailable.


Apply multi-metrics

Analytics can support multiple datasets within the same panel, allowing you to compare different metrics against each other in the same chart without the need to create individual charts for each metric. For example, you may want to compare the performance of different intents against each other over the same period of time.

Multi-metrics are currently only supported for Bar charts, Line charts, and Tables.

As an example, let's compare the number of actions invoked versus the number of data requests invoked in a single Line chart:

  • Select an existing Analytics dashboard or + Add new. If choosing an existing dashboard, hover beside the dashboard name to select the edit option

  • Select + Add panel > Hover over panel > Click the edit icon

  • Enter a name & description of the panel

  • Select Line chart for Chart type

  • Click + Add dataset link > Enter name (in this example, we'll name it Actions)

    • Select the metric for the data to be measured, which in this case is Actions invoked

    • Select the time interval of how the data will be displayed in the line chart. Day will show the results on a daily basis

    • Select the sum aggregation to get the total counts of actions invoked

    • Select respective filters to create any subset of data

  • Click + Add dataset > Enter name (in this example, we'll name it Data requests)

    • Repeat steps above as done for the Actions dataset, except select the metric Data requests invoked

  • When done, click Save

Last updated