How to Use the LAST Function

Learn how you can use the LAST data function in your formulas.

Last updated: Feb. 24, 2022

The Last data function tells Plecto to return the latest registration values from a data source. Do you want to keep track of your latest activities? Use this function and create KPIs focused on your latest deals, calls, and other metrics. The Last function works well with our table and timeline widgets. Read more in the help guide KPI Examples for the Timeline Widget.

Example: Call Records

This example shows how to create a formula for tracking the latest calls and how the formula looks on the timeline widget on dashboards. The formula uses a date modifier and a filter.

last-data-function-formula-editor-4.png
  1. Go to KPI management > Formulas > + New formula.
  2. Create a new Data function component by clicking on the "+ New component" button or by dragging the component into the editor from the component bar on the right.
new-formula-editor-new-component.png

3. Select "Last" under "Lookup function."
4. Choose a data source and field relevant to your organization, then click "Done." In this example, we are using a data source called "Adversus Calls" and the field is "Answer Time."

last-data-function-formula-editor-1.png

5. (Optional) Since the default date field in the data source "Adversus Calls" is "Created date" (date and time when the registration was created), we are applying a date modifier to make the formula think of "Answer Time" as the default field instead. This step is optional and depends on the default date field in your data source. Read more about date and history modifiers.

last-data-function-formula-editor-2.png

6. (Optional) In this example, we want to add a filter to only look at the latest answered calls. The formula filters on a field called "Disposition" and looks for field values "is: answered."

last-data-function-formula-editor-3.png

7. Change the number formatting to "Date and time" and click "Save" in the bottom-right.

last-data-function-formula-editor-5.png

Here is an example of how the KPI looks when added to a timeline widget.

last-data-function-timeline.png

Was this article helpful?

Please leave a comment to help us improve.