# Introduction to the New Formula Editor (BETA)

Introduction to the formula editor in Plecto and its features.

###### Table of contents

### Formula editor

The formula editor allows you to create both basic and advanced calculations using a list of features. While building your KPIs, you can choose the number format, add conditional colors, prefix, suffix, apply date and history modifiers, as well as preview the final formula result right in the editor.

An example of the formula editor in Plecto.

### Components

The formulas are built on components. A component can be, for example, a data function (number of, the sum of, minimum, maximum, average, and more), an existing formula, IF function, group, date function, or a static number. You can add as many components to your formulas as you like.

An example of the available components in the formula editor.

**Data function**– This component allows you to calculate the sum, quantity, average, and other values from a data source.**Existing formula**– This component allows you to use one of your existing formulas as part of the current, new formula.**IF function**– With this component, you can create IF statements and establish a condition that returns one value if your KPIs meet the condition and another if not.**Group**– Grouping works just like parentheses. You can add new components to the group or drag and drop them across the formula editor.**Date function**– This component counts the number of days, workdays, or holidays within the time period you select on the widget.**Static number**– This component allows you to add a fixed number to the formula.

Read the full guide on how to build a formula with examples.

### Preview

You can preview the result of your formula right in the formula editor. Choose the widget type and approximate time period to preview your KPI before adding it to your dashboards or reports.

An example of the preview window in the formula editor.

### Conditional colors

Conditional colors allow you to format the widget's font color based on custom values. Set your own conditions and choose different values that correspond to your targets. Read the full article on Conditional Colors.

Examples of adding different conditional color options in the formula editor.

- Click
**+ New condition**to add a conditional color. - Type in a condition, for example
*8000*or*Yes*, depending on what values you expect and how you format the formula output (read below). To change between the green, yellow, and red colors, click the color button on the right.

### Number format

You can choose the format of the formula output. Number formatting determines how the result of the formula will show on your dashboards and reports.

The available number formatting options are:

**Text**– Display the latest completed tasks, campaign names, or any other text.**Decimal number**– Display a number value.- With this option, you can select the number of digits that appear after the decimal point.
- You can also reverse the trend indicator (the small triangle on the widget that appears green or red whenever a value increases or decreases) to recognize lower values as the preferred outcome. For example, 3 minutes of the average call waiting time is better than 5 minutes.

**Yes / No**– The formula will return "No" if the result is 0 or "Yes" if the result is 1 or higher.**Percent**– Display values as a percentage. Here, you can also select the number of digits that appear after the decimal point or choose to reverse the trend indicator.**Duration**– Show the duration of your activities. If you have a column in your data source that shows the duration of an activity in seconds, this formatting option will make sure to convert your data to an understandable duration output. For example, 7 days 10:35:12.**Date and time**– Display the date and time of your last closed deal, average resolution time, or any other date and time from a date field in your data source.**Date**– Display the date of your upcoming billing, last closed deal, or any other date from a date field in your data source.**Time since**– Display the running time since an activity started. The time counting starts from the date and time that is returned from the formula.

###### Lower value is better

If your goal is to achieve lower KPIs, then select "Lower value is better" in the formula editor. This option is available for **decimal numbers** and **percentages**. For example, 2 missed calls are better than 10, or 3 minutes of the average call waiting time is better than 5 minutes.

### Was this article helpful?

Please leave a comment to help us improve.