I am trying to add calculations for areas that intersect a project boundary, but have run into an issue with single part polygons returning an area for each intersecting polygon. I ran a test with a new layer with the polygons dissolved to multi part polygons and I get the results I want, but I need to be able to group the data from single part polygons as its not possible to edit some of the layers I need to run this on. I've included the Arcade code below that I've used, along with screen captures of the results on the single and multi part polygons.
I did some searching and found the GroupBy function, but cant figure out how to set that up it will even do what I want.
var MA_intersect = Intersects(FeatureSetByName($map,"ManagementAreas"), $feature);
var cnt = Count(MA_intersect);
if (cnt > 0) {
var MAs = "";
for (var MA in MA_intersect) {
var intersectArea = 0
intersectArea += Round(AreaGeodetic(Intersection($feature, MA), "acres"), 1);
MAs += TextFormatting.NewLine + MA.NAME + ": " + Text(intersectArea, '#,###.#') + " Acres" + TextFormatting.NewLine;
}
//result += TextFormatting.NewLine + MAs;
return MAs;
} else {
return "No Overlaping Management Areas"
}
Results with multi part polygons:

Results with single part polygons (I want this to look like the popup above):
