Hello All,
I'm trying to calculate the percent change in population between different hosted feature layers in a web map for a dashboard indicator. I am unfamiliar with Arcade but below is what I have pieced together so far.
var starYear = FeatureSetByName($map, 'Census City Blocks 2020')
var tenYear = FeatureSetByName($map,'Census City Blocks 2010')
var tenYearPop = {'fields': [{'name': 'Total_Pop', 'type': 'esriFieldTypeInteger'}],
'geometryType': '', 'features': []};
var todayPop = {'fields': [{'name': 'Total_Pop', 'type': 'esriFieldTypeInteger'}],
'geometryType': '', 'features': []};
var tenYearChange = round(((todayPop-tenYearPop)/todayPop)*100, 2) +'%'
return tenYearChange
The result of the code above is shown below.

The result should be 5.98%. The field name for the population for both feature layers is Total_Pop. Any idea on how to calculate this?