Description
The LAST
function finds the latest occurrence of a value in a Subform’s Field when sorted by another Field in the same Subform.
Usage
LAST([Subform field].ValueField, [Subform field].SortField)
- Subform field: the Subform containing the Fields
- ValueField: the Field whose value to find
- SortColumn: the Field containing the values on which the sorting is based
Remarks
The LAST
function accepts arguments with the following types:
- Number
- Text
- Date
- Week
- Month
Please note that the way the aggregation is performed heavily depends on the type of the input.
Examples
Tracking household health status over time
Suppose you are tracking the number of sick family members across households over time. You have a parent Form called "Households" and a Subform "Health Check-ins":
Family | Health Check-ins |
---|---|
Ahunna | 2 |
Bilal | 2 |
The Subform contains a list of all the health check-ins, along with the date of the check-in.
Family | Number of sick family members | Date of reporting |
---|---|---|
Ahunna | 3 | 2023-01-15 |
Bilal | 1 | 2023-02-10 |
Ahunna | 4 | 2023-01-20 |
Bilal | 2 | 2023-01-15 |
You can add a Calculated field to the parent household Form shows the latest reported number of sick family members for each family using the following formula:
LAST([Health check-ins].[Number of sick family members],
[Health check-ins].[Date of reporting])