I have a collection of data 'FacilityCollection' that contains a list of unique facilities (unique identifier is 'facility_id'). I would like to show the entire 'FacilityCollection', but add a column that shows the most recent/max 'last_updated' date from the SharePoint list 'sp_form_facility' (matching 'facility_id' from 'FacilityCollection' to 'current_fac_id' from 'sp_form_facility'.
Basically, I am trying to provide a list of all facilities and see when is the last time they sent us an update or show a blank in the 'last_updated' field if no update has ever been sent. See the 'Desired Output' table below for an example of what I am looking for.
Any help would be greatly appreciated! Thank you!!
FacilityCollection
| facility_id | location |
| 1 | Chicago |
| 2 | New York |
| 3 | Memphis |
| 4 | Tampa |
| 5 | Miami |
| 6 | Tempe |
| 7 | Billings |
| 8 | Atlanta |
| 9 | Dallas |
sp_form_facility
| current_fac_id | created_date | update_notes |
| 1 | 1/1/2024 | Testing |
| 1 | 1/2/2024 | Hello |
| 4 | 1/3/2024 | Hi |
| 2 | 1/4/2024 | Test |
| 4 | 1/5/2024 | Bye |
Desired Output
| facility_id | location | last_updated |
| 1 | Chicago | 1/2/2024 |
| 2 | New York | 1/4/2024 |
| 3 | Memphis | |
| 4 | Tampa | 1/5/2024 |
| 5 | Miami | |
| 6 | Tempe | |
| 7 | Billings | |
| 8 | Atlanta | |
| 9 | Dallas | |