<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sum on a related table field in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/sum-on-a-related-table-field/m-p/1564458#M62660</link>
    <description>&lt;P&gt;If I understand correctly, in the feature layer's pop-up, I add the following Arcade expression (the reason I ask is that I get a blank result every time):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var relatedFeatures = FeatureSetByRelationshipName($feature, 'RelatedTableName', ['RelatedTableFieldName'], false)
var summary = GroupBy(relatedFeatures, '1', { name: 'Sum', expression: 'RelatedTableFieldName', statistic: 'Sum' });
return First(summary).Sum&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Dec 2024 16:34:04 GMT</pubDate>
    <dc:creator>MathieuCain</dc:creator>
    <dc:date>2024-12-04T16:34:04Z</dc:date>
    <item>
      <title>Sum on a related table field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sum-on-a-related-table-field/m-p/1564038#M62627</link>
      <description>&lt;P&gt;I have a feature layer in an ArcGIS Online map (could be point or a polygon) that has a one-many relationship with a table (previously established through a geodatabase upload). In the feature layer popup, I would like it to display the sum of the values in a single field in the related table (I've seen examples of Arcade expressions that sum the values of multiple fields in a single record, but I am interested in a more basic summary statistic of multiple records in a single field). I need this to be a dynamic calculation so that when records are updated in the related table, that sum will be updated as well.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The follow-up question is how that calculated field will translate to the dashboard. Will it be treated as an actual field in the feature class layer (and have the zoom/pan map functionality if selected), or will it be treated as part of the related table (i.e., related tables in dashboard are not supported for zoom/pan in a map).&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 13:36:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sum-on-a-related-table-field/m-p/1564038#M62627</guid>
      <dc:creator>MathieuCain</dc:creator>
      <dc:date>2024-12-03T13:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sum on a related table field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sum-on-a-related-table-field/m-p/1564233#M62647</link>
      <description>&lt;P&gt;You can use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#featuresetbyrelationshipname" target="_self"&gt;FeatureSetByRelationshipName&lt;/A&gt; function to get the related records for your feature, then use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#groupby" target="_self"&gt;GroupBy&lt;/A&gt; function on that FeatureSet to get the sum of the values in a particular field. That would look something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var relatedFeatures = FeatureSetByRelationshipName($feature, 'the relationship name', ['your field'], false)
var summary = GroupBy(relatedFeatures, '1', { name: 'Sum', expression: 'your field', statistic: 'Sum' });
return First(summary).Sum&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 03 Dec 2024 18:36:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sum-on-a-related-table-field/m-p/1564233#M62647</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-12-03T18:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sum on a related table field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sum-on-a-related-table-field/m-p/1564458#M62660</link>
      <description>&lt;P&gt;If I understand correctly, in the feature layer's pop-up, I add the following Arcade expression (the reason I ask is that I get a blank result every time):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var relatedFeatures = FeatureSetByRelationshipName($feature, 'RelatedTableName', ['RelatedTableFieldName'], false)
var summary = GroupBy(relatedFeatures, '1', { name: 'Sum', expression: 'RelatedTableFieldName', statistic: 'Sum' });
return First(summary).Sum&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 16:34:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sum-on-a-related-table-field/m-p/1564458#M62660</guid>
      <dc:creator>MathieuCain</dc:creator>
      <dc:date>2024-12-04T16:34:04Z</dc:date>
    </item>
  </channel>
</rss>

