<?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: Arcade:  Calc Field - Average Values with Same Timestamp in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calc-field-average-values-with-same/m-p/1327723#M72958</link>
    <description>&lt;P&gt;For a field calculation, we're evaluating the expression per row of the table, and we only have to worry about matching values. By filtering the full layer based on the date field, you can easily get that subset, then use the Average function to get the numeric average of any field.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = $layer

var matching_ts = Filter(fs, `date_field = ${$feature['date_field']}`)

return average(matching_ts, 'numeric_field')&lt;/LI-CODE&gt;&lt;P&gt;Whether or not this works will depend on where the data is at, too. For some database providers, the timestamp needs to be wrapped in "timestamp '...'". Also, the variable $layer may not work there, so you may need to use a FeatureSet function to bring the rest of the layer's values in.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 14:12:45 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2023-09-12T14:12:45Z</dc:date>
    <item>
      <title>Arcade:  Calc Field - Average Values with Same Timestamp</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calc-field-average-values-with-same/m-p/1327681#M72953</link>
      <description>&lt;P&gt;I am trying to mimic the Average field calculation in the below table, in Arcade.&amp;nbsp; Anybody lend a hand?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ArmstKP_0-1694524437509.png" style="width: 571px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/80425i17AB65DEC7E51145/image-dimensions/571x230?v=v2" width="571" height="230" role="button" title="ArmstKP_0-1694524437509.png" alt="ArmstKP_0-1694524437509.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 13:14:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calc-field-average-values-with-same/m-p/1327681#M72953</guid>
      <dc:creator>ArmstKP</dc:creator>
      <dc:date>2023-09-12T13:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade:  Calc Field - Average Values with Same Timestamp</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calc-field-average-values-with-same/m-p/1327723#M72958</link>
      <description>&lt;P&gt;For a field calculation, we're evaluating the expression per row of the table, and we only have to worry about matching values. By filtering the full layer based on the date field, you can easily get that subset, then use the Average function to get the numeric average of any field.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = $layer

var matching_ts = Filter(fs, `date_field = ${$feature['date_field']}`)

return average(matching_ts, 'numeric_field')&lt;/LI-CODE&gt;&lt;P&gt;Whether or not this works will depend on where the data is at, too. For some database providers, the timestamp needs to be wrapped in "timestamp '...'". Also, the variable $layer may not work there, so you may need to use a FeatureSet function to bring the rest of the layer's values in.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 14:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calc-field-average-values-with-same/m-p/1327723#M72958</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-09-12T14:12:45Z</dc:date>
    </item>
  </channel>
</rss>

