Hi @Yazeed_Ablan ,
There are a lot of unknowns here - on the face of it you're facing a chicken and egg scenario with your first record not having a previous record, or your last record not having a next record. Not sure if you're wanting to update the existing list once-off, or just figure out a formula to maintain the list as new data is captured.
I'll have to assume for now that we're adding new records with Patch() and you want the new record's StartDate to update the last record's EndDate. If this is not what you mean, please try and clarify.
Otherwise you can consider something like the following when a new record is captured;
Patch(mySource, Defaults(mySource), {
StartDate: Patch(mysource, Last(mySource), {EndDate: StartDateInput}).EndDate
}
)
StartDateInput here is wherever your input for the StartDate of the new record is coming from.
If it's a datepicker or something it would be the control output - eg: DatePicker.SelectedDate
In effect, you're running two Patch() functions - the first updates the last record enddate with the startdate input, the second adds a new record with the startdate input. They're just nested like this to try and reduce inconsistencies if other people are also adding records in between these two functions - however it's still possible that Last() when the inner Patch() is run could be different to the last record when the outer Patch() is run, depending on how often and how fast people are updating this list.
Hope this helps,
RT