AnsweredAssumed Answered

How to use the GroupBy in Arcade?

Question asked by davidmidamerica on Oct 8, 2019
Latest reply on Oct 14, 2019 by xander_bakker
Branched to a new discussion

I'm struggling a little with the GroupBy function in Arcade.  I have a polygon layer of census blocks in AGOL with a population, color-code, and location field.  Like this:


Population: 1,540

Color: LT Purple

Location: Jacksonville


The color field has 3 variables: LT Purple; DK Purple; and White. Because the census blocks are in different areas around the country I added the Location field to differentiate them.  (This is one layer that has all of the census blocks for each study area, about 10 areas in total.)


My Goal: I want to use the GroupBy function in my popup to total each population by color and by location each time a user clicks on one of the census blocks.  Is there a way to wrap a GroupBy inside a GroupBy or is my only choice going to be to add a larger boundary layer to utilize the Intersect function to differentiate the locations?  I'm a little afraid of the Intersect function because it is a geometry function that might slow down the pop-up, plus I also need to add a layer and then hide it from my end users.