Formulas

Learn to apply calculated metrics to analytics dashboards in NLX's Dialog Studio

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:

OperationUsageExamples

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:

OperationUsageExamples

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.

Last updated