Hello,
I am trying to create an Arcade data expression in a Dashboard. I am trying to calculate an average Trees/Acre for each Stand.
var p = 'https://maps.arcgis.com'
var itemId = 'a8af124e92af44579e3fd07bb59ebb4c'
var fs = FeatureSetByPortalItem(Portal(p), itemId, 0, ['Stand_No', 'Tally', 'Plot_Configuration', 'Plot_Name', 'Plot_Status', 'Plot_Size'], false)
var Mach = Filter(fs, 'Plot_Size = 0.01 * 10000')
var Hand = Filter(fs, 'Plot_Size = 0.02 * 2500')
return GroupBy(fs,['Stand_No','Plot_Configuration'],[{name: 'TallySum', expression: 'Tally',statistic: 'SUM'},
{name: 'TCount', expression: '1', statistic: 'COUNT'},{name: 'MachAcres', expression: 'Mach', statistic: 'AVG'},
{name: 'HandAcres', expression: 'Hand', statistic: 'AVG'}])
For each individual 'Stand_No':
- I need to multiply each Tally by either 50 or 100 based on the attributes in the 'Plot_Size' field.
- Find the average of that new number
- I'm pretty sure the var in Lines 5 & 6 are incorrect. They are supposed to do the calculations to change the Plot_Size of 0.01 and 0.02 to 100 and 50 respectively to use as a multiplier. Ex: (0.01 = multiplyer of 100) and (0.02 is multiplier of 50) and then get the average of those numbers in the GroupedBy expression since I need them by Stand_No
For Example: StandNo = 02331254
- There are 3 Plot (Tally) points.
- Plot 3: Tally = 11
- Plot 6: Tally = 11
- Plot 9: Tally=12
- The Plot_Size is "0.02" so I need to multiply the Tally numbers by 50.
- 11*50 + 11*50 + 12*50 = 1700
- I need to find the average of that new number (there are 3 plot points in that stand)
- 1700/3 = 566.66 Trees per Acre per Stand
Thank you!