How to Use the LAST Function

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

Last updated: Feb. 7, 2023

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.

  1. Go to 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.

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."


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.


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."


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


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


Was this article helpful?

Please leave a comment to help us improve.