How to create a formula
In this guide, we will create a formula using the Data function component to show how you can build Plecto formulas using data from your data sources.
Here's how to create a formula in the Visual formula editor (default):
Go to Formulas > New formula. You will now see the Visual formula editor.
Give your formula a title. You'll be able to find the formula by its title in the formula list, on dashboards, in reports, and other places where formulas are used.
Click New component and select Data function (top-left corner). Learn about the other functions below.
The next step is to select a data source (for example, Salesforce Opportunities).
Function. This will tell Plecto how to calculate your data.
(Optional) Adjust the Date field. By default, the formula will refer to the default date fields of the used data sources, but you can change that in each individual formula.
(Optional) Click Add filter to get specific data. For example, to only see the number of outgoing calls.
(Optional) Repeat steps 3 – 7 if needed. Feel free to combine data from different data sources.
Check the Number format. If you expect to see text, percentage, date, duration, or other formats on a widget, make sure to choose the matching number format.
(Optional) Add conditional colors. For example, if you add 0 (red) – 50 (yellow) – 100 (green), the widget will show your data in red between 0 and 49, yellow between 50 and 99, and green when you reach 100 and more.
(Optional) Add a prefix of suffix.
Click Save to finish.
What are the different functions?
Data functions tell Plecto how to calculate your data:
Sum of sums all the values from a specific field in a data source. For example, if you want to calculate the total value, you should use this function.
Number of calculates how many registrations there are in the data source.
Number of unique calculates how many unique registrations there are in a specific field in a data source. For example, if there are 2000 registrations of the products you've sold, but you only sell 3 different kinds of products, the formula will return 3.
First will find the very first (oldest) registrations in your data source.
Last will find the latest (newest) registrations in your data source.
Min will find the smallest value in a specific field.
Max will find the highest value in a specific field.
Avg will calculate the average value from a specific field.