I am new to using Arcade expressions. I want a dashboard to aggregate data from 4 different feature layers into a table or a chart. The data has four maps with polyline feature layer representing each year 2023, 2026, 2036 and 2045. I was able to create aggregated data from individual layers by repeating the following code for each layer's data source.
var fs = FeatureSetByPortalItem(Portal('https://tamu.maps.arcgis.com'), '302880accba645198a5174df9f51b300', 3,['STREET','FAC_TYPE','NUM_LANES','MTP_ID'])
var agg = GroupBy(fs,['MTP_ID','FAC_TYPE','STREET'],[{name:'Lanes',expression:'NUM_LANES',statistic: 'MAX'}])
var agsum = GroupBy(agg,['MTP_ID','FAC_TYPE'],[{name:'Lanes',expression:'Lanes',statistic:'SUM'}])
return agsum
Ideally I want them in a single table which shows the number of lanes in each year for each MTP ID. I am not sure which function to use to append tables with arcade expressions. Any help would be appreciated.