Hello,
I am struggling with using the Arcade's GroupBy with the Top and OrderBy Functions.
Basically I have a polygon layer which references and counts the number of features from another point layer, and I want to display in the popup the top 3 attributes based on counts within each polygon.
I have attached a file the arcade expression code I have so far for the polygon layer, however it is not working at moment (nothing being written in the popup). I am trying to get it to count the total number of point features within any given polygon, group by the attribute value of the facility_name field and find the top 3 facilities that have the highest point count
I am looking for the popup to show something like the following when a polygon is selected:
The Top 3 Facilities in this area are:
1. Facility A: 400 Patients
2. Facility B: 200 Patients
3. Facility C: 100 Patients
Greatly appreciate any help or advice with the code.
Regards,
Isaac