How to Build a Formula in the New Editor (BETA)

A guide on how to build your custom KPIs in Plecto.

Last updated: Nov. 25, 2021

Create a formula

All formulas are built in the formula editor in Plecto. To create a new formula:

  • Go to KPI management > Formulas > + New formula.
  • Give your formula a clear title that best describes its purpose and is easy to find in your KPI list.
  • Now you can start adding components and filters, apply date and history modifiers, choose the number format, add conditional colors, and more.

Adding components

Components are the fundamental parts of your formulas. 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 an indefinite number of components to your formulas. Click on "+ New Component" and select one of the options.

new-formula-editor-new-component.png

An example of the available components in the formula editor.

Data functions

The data functions allow you to create a wide range of calculations made based on the data in your data sources. A data function searches for information within the registrations and fields in your data source, and the type of data function determines how Plecto handles the calculations. Read more about data functions in Plecto.

new-formula-editor-data-functions.png

An example of the available data functions in the formula editor.

Existing formula

This component allows you to use one of your existing formulas as part of the current formula. Adding an existing formula as a component will replicate that formula but will in no way modify its original structure. However, if you change the existing formula, this component will also change in all the other formulas where it is used.

You can preview the existing formula right in the formula editor. Add a new existing formula component, open the drop-down list, hover over a formula, and click on "Preview formula" on its right. A slide-in on the right will appear where you can preview the existing formula.

IF function

This component enables you to create IF statements and establish a condition that returns different values, depending on whether your KPIs meet the condition or not. With the IF function, you can create statements that return both numerical values or text.

Group

Grouping works just like parentheses. To create a group, add a new group component or drag and drop independent components onto each other to group them. Similarly, grab and drag the components out of the group to ungroup them. You can also place a group within a group to create nested parentheses.

Date function

This component counts the number of days, workdays, or holidays within the time period you choose on the widget. You can use it to calculate daily targets or any other metrics where you need to consider the number of days, workdays, or holidays in the calculations.

For example, selecting "Workdays" from "Widget start date" to "Widget end date" will make the formula output 5 if you set the time period to the current week. If you have a weekly target that you divide by this number, you will obtain a daily target value.

Similarly, if you select "Days" from "Widget start date" to "Widget end date" and set the time period to the current month, the formula will output 30, 31, 28, or 29, depending on what the current month is.

Static number

This component allows you to add a fixed number to the formula.

Adding filters

Once you have created a component using a data function, you can easily add filters to make Plecto look at specific data in your data source.

Click on "+ Add filter" and choose the field you want to filter. Then, select a comparator, type in the filtering condition (applies to all comparators except "is empty" and "has any value"), and click "Done."

new-formula-filters.png

An example of a data function component with three added filters.

Date & History modifiers

All components based on data functions allow you to apply date and history modifiers. Read the full article on the date and history modifiers.

The date modifier makes the component look for information in your data source based on another date field than the default date. For example, if the default date in a data source is "Created date," you can use a date modifier to make the formula look at data based on the "Closed date" field instead.

  • To apply a date modifier, click on the "More" menu in a component's top-right corner, then click on "Date field." You will see a list of all the available date fields in the data source, including the default date. Select any of the fields from the list to change the date used in your component.

The history modifier manipulates the formula to include data from a different time period outside of what you can select on widgets, reports, notifications, or other features where formulas are utilized.

  • To apply a history modifier, click on the "More" menu in a component's top-right corner, then click on "History modifier." Select a period, then click on "Done."

Number format

A formula result can be formatted in multiple ways, which will change the way it is displayed on your dashboards and reports. You can change the number format in the formula editor. The available formatting options are text, decimal number, Yes/No, percent, duration, date and time, date, and time since. See the different number formatting outputs in the video below.

  • Text: Display the latest completed tasks, campaign names, or any other text that is part of your data.
  • 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 also can 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 into a clear duration output. For example, 7 days 10:35:12.
  • Date and time: Display the date and time of your latest closed deals, 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, latest closed deals, 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.

Example formulas

Here are some basic KPI examples that you can use in your organization. For more inspiration, visit our KPI Inspiration page.

Conversion Rate (%)

In this example, the formula divides the number of won deals by the total number of deals to return the conversion rate of won deals.

  1. To create this formula, add the first component that counts the number of [data source name], and add a filter to the component to specifically count the registrations with the status "won."
  2. Add another component that counts the number of [data source name]. This component will count all the registrations in your data source.
  3. Change the operator to ➗.
  4. Set the number format to "Percent."
  5. To finish, click on "Save" in the bottom-right corner.
formula-conversion-rate.png

An example of a formula that calculates the conversion rate of won deals from a data source "Pipedrive Deals."

Revenue

This example shows how to create a formula to calculate revenue based on data from different data sources. Create a new component for each data source you want to get data from and apply filters if necessary.

formula-revenue-example.png

An example of a formula that returns a revenue from different data sources.

Blank filters

This example shows how to create a formula that counts blank registrations (that have no data) in a specific field. This could be useful to obtain, for example, the number of ongoing calls or deals that don't have an estimated value yet.

All you have to do is create a component that counts the number of [data source name] and add a filter where the comparator is "is empty."

formula-empty-filter.png

An example of a formula that counts the number of empty registrations from a field "End Time" in a data source "Adversus Calls."

Alternatively, you can select the comparator "has any value" to see all the registrations that are not blank (have data) in the field. The formula will then filter and include registrations that are not empty. Let's say you have a data source that contains the information of your sales deals, and you want to see the number of deals that have a close date in the data source.

formula-filter-has-any-value.png

An example of a formula that counts the number of registrations that have any value in the field "End Time."

Was this article helpful?