<?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 Calculation Rule Help - Average non null values in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184704#M56393</link>
    <description>&lt;P&gt;This is my biggest gripe with Arcade: it treats null values as zero. To circumvent that, you have to manually check each value for null, for example like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var values = [$feature.Lot_Cost,
    $feature.Lot_Cost_,
    $feature.Lot_Cost__,
]
var value_sum = 0
var value_count = 0
for(var i in values) {
    if(values[i] != null) {
        value_sum += values[i]
        value_count ++
    }
}
return value_sum / value_count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Related idea (though I don't think this will be implemented):&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-ideas/arcade-don-t-treat-null-as-zero-in-mathematical/idi-p/1147431" target="_blank"&gt;Arcade: Don't treat null as zero in mathematical f... - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jun 2022 15:27:15 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-06-21T15:27:15Z</dc:date>
    <item>
      <title>Arcade Calculation Rule Help - Average non null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184692#M56391</link>
      <description>&lt;P&gt;Hello, I am trying to get the following rule to work. I have 3 fields that I would like to get the average from, but in some instances not all 3 fields have values and are null. I would like to average the non null values. I have tried Count, and other varies methods but cant seem to get it to work. Any help would be appreciated. Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR LC1 = $feature.Lot_Cost&lt;BR /&gt;VAR LC2 = $feature.Lot_Cost_&lt;BR /&gt;VAR LC3 = $feature.Lot_Cost__&lt;BR /&gt;VAR AVLOT = COUNT([LC1,LC2,LC3])&lt;/P&gt;&lt;P&gt;SUM(LC1,LC2,LC3) / AVLOT&lt;/P&gt;&lt;P&gt;The above is what I am working on, but returns the wrong value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 15:13:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184692#M56391</guid>
      <dc:creator>Robswann</dc:creator>
      <dc:date>2022-06-21T15:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Calculation Rule Help - Average non null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184704#M56393</link>
      <description>&lt;P&gt;This is my biggest gripe with Arcade: it treats null values as zero. To circumvent that, you have to manually check each value for null, for example like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var values = [$feature.Lot_Cost,
    $feature.Lot_Cost_,
    $feature.Lot_Cost__,
]
var value_sum = 0
var value_count = 0
for(var i in values) {
    if(values[i] != null) {
        value_sum += values[i]
        value_count ++
    }
}
return value_sum / value_count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Related idea (though I don't think this will be implemented):&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-ideas/arcade-don-t-treat-null-as-zero-in-mathematical/idi-p/1147431" target="_blank"&gt;Arcade: Don't treat null as zero in mathematical f... - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 15:27:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184704#M56393</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-06-21T15:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Calculation Rule Help - Average non null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184712#M56394</link>
      <description>&lt;P&gt;The immediate workaround to this that comes to mind would be to add a string of code to select all values that are "not null" from the desired feature classes and then passing those selected values to your new variables for calculation. Best of luck!&lt;/P&gt;&lt;P&gt;Derek Wood&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pasco County Public Works&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 15:43:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184712#M56394</guid>
      <dc:creator>drWood</dc:creator>
      <dc:date>2022-06-21T15:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Calculation Rule Help - Average non null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184714#M56396</link>
      <description>&lt;P&gt;This is perfect. Thanks again&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 15:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculation-rule-help-average-non-null/m-p/1184714#M56396</guid>
      <dc:creator>Robswann</dc:creator>
      <dc:date>2022-06-21T15:46:18Z</dc:date>
    </item>
  </channel>
</rss>

