Hi,
I am looking for an arcade expression that groups (Groupby) by a field (ano/year) the sum of two fields (area_ha and area_km2) and that returns a field calculating the division of those sums.
In summary I want to combine two columns of a layer, dividing the sum of each one with each othe.
Fields: Ano (years), Area_ha and Area_km2
Code:
var p = 'https://www.arcgis.com'
var itemId = 'e5f830354f5a4542b5ef6ad63da94d80'
var fs = FeatureSetByPortalItem(Portal(p), itemId, 0, ['*'], false)
var GroupBy(fs, ['Ano'],
[ { name: 'sum_area_ha',
expression: 'Area_ha',
statistic: 'SUM' },
{ name: 'sum_area_km2',
expression: 'Area_km2',
statistic: 'SUM' },
])
Return GroupBy (sum_ano / sum Perimeter)