Hi Everyone;
I need to ClearCollect a Filter the most updated Supervisor for each Location, so it could be displayed with all its data on a ComboBox. Now gonna expand:
I had an app for my Supervisors where they can create records on a Sharepoint List ONLY for locations where they are assigned currently assigned.
For this, I'm using two Sharepoint Lists:
Sharepoint List 1 "Listado_Localidades": With currently 210 records and low growing, and where are every single location that is available and active):
| ID | Nombre_de_la_Localidad | Active |
| 1 | Contoso HQ | Yes |
| 2 | Contoso West Coast | No |
| 3 | Contoso East Coast | Yes |
| 4 | Adventure Works | Yes |
And
Sharepoint List 2 "LocalidadesSupervisadas": With almost 700 records and growing like 100 per year. Where it's a record of every single Supervisor that had supervised every single location:
| ID | ID_Localidad | Nombre_de_la_Localidad | Supervisor_Correo |
| 1 | 1 | Contoso HQ | tim@consoto.com |
| 2 | 1 | Contoso HQ | bob@contoso.com |
| 3 | 2 | Contoso West Coast | tim@consoto.com |
| 4 | 3 | Contoso East Coast | tim@consoto.com |
| 5 | 4 | Adventure Works HQ | bob@contoso.com |
| 6 | 4 | Adventure Works HQ | tim@consoto.com |
Currently, the formula used was provided by "v-bofeng-msft " through this previous post, which worked great at the beginning :
Filter(
Locations,
ID in Search(ForAll(Distinct(Supervisor,Location_ID),Last(Sort(Filter(Supervisor,Result=Location_ID),ID,Ascending))),CurrentUser.Mail, "Supervisor_Email").Location_ID
).Name
But I'm having performance issues where it can take up to 40 seconds to load, both after Published on endpoints and even in testing.
Could provide any help on optimizing this?