<?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() returning Nan Value in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166326#M54266</link>
    <description>&lt;P&gt;Sorry for the confusion... The FullVaccin is the fieldname on AGOL while Join_Count is for the original table in ArcPro..... and the table has not be joined with another table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;($feature.Calculation * 1000)/Join_Count&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This works but did not give the accurate percentage&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 18:54:57 GMT</pubDate>
    <dc:creator>godofsix</dc:creator>
    <dc:date>2022-04-20T18:54:57Z</dc:date>
    <item>
      <title>Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166202#M54250</link>
      <description>&lt;P&gt;I'm trying to compute the percentage of a field using the sum of all the fields:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$feature.FullVaccin / Sum($feature.FullVaccin)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But every time I test, I get 1.... What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166202#M54250</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T17:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166259#M54253</link>
      <description>&lt;P&gt;Try something like this... I'm running this in field calculator and filtering on an ID, but edit at will.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var myid = $feature.COJ_FacilityID
var mysum = 0
var myfs = filter(featuresetbyname($datastore,"BogusPumps",['Integer1'],false),"COJ_FacilityID = @myid")
if(!IsEmpty(myfs)){
  var mysum = ($feature.Integer1/Sum(myfs,'Integer1'))
}
return mysum&lt;/LI-CODE&gt;&lt;P&gt;I ran this on the field "Float1" against this data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1650476697604.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39460i0EC139D0CC1E27A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1650476697604.png" alt="KimGarbade_0-1650476697604.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:45:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166259#M54253</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-20T17:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166271#M54254</link>
      <description>&lt;P&gt;Thanks so much. I tried it and I still get the same 1 as the output result&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:54:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166271#M54254</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T17:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166278#M54257</link>
      <description>&lt;P&gt;Hmmm... what data type is FullVaccin?&amp;nbsp; Also, are you using Field Calculator?&amp;nbsp; If so, what is the data type of the field you are calculating?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:03:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166278#M54257</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-20T18:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166282#M54259</link>
      <description>&lt;P&gt;Long&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:04:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166282#M54259</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T18:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166287#M54260</link>
      <description>&lt;P&gt;If you are calc'ing into a Long also, it might not like getting numbers to the right of a decimal.&amp;nbsp; Try calc'ing into Float or a Double.&lt;/P&gt;&lt;P&gt;Since percentage is going to be a decimal number by definition it only show 0 or 1 when you calc into an integer type.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1650478669279.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39468iB0488D0BAD8D6862/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1650478669279.png" alt="KimGarbade_0-1650478669279.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;if you multiple by 100 it will show an int.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166287#M54260</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-20T18:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166295#M54261</link>
      <description>&lt;P&gt;Did and still got 1&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="godofsix_0-1650478345269.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39466i55ECACDA72A65574/image-size/medium?v=v2&amp;amp;px=400" role="button" title="godofsix_0-1650478345269.png" alt="godofsix_0-1650478345269.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Though, my ultimate aim is to use it for custom label in a web map&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:13:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166295#M54261</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T18:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166302#M54262</link>
      <description>&lt;P&gt;Still getting 1?&amp;nbsp; That is odd... are their any nulls in your table that you have to account for or does every row contain a FulVaccin value?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:20:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166302#M54262</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-20T18:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166306#M54263</link>
      <description>&lt;P&gt;There are no nulls&lt;/P&gt;&lt;P&gt;Here is the table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="godofsix_0-1650478909883.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39469iB24A8B956136BD0A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="godofsix_0-1650478909883.png" alt="godofsix_0-1650478909883.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:21:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166306#M54263</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T18:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166319#M54264</link>
      <description>&lt;P&gt;Is "FullVaccin" off the page to the left?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the table joined with another table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you run a calc on Percentage again, and this time just&amp;nbsp; do something simple like&lt;/P&gt;&lt;P&gt;($feature.Calculation * 1000)/Join_Count&lt;/P&gt;&lt;P&gt;(just using data I see in your table); it will return a useless number, but does that result also show 1 every time?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:47:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166319#M54264</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-20T18:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166326#M54266</link>
      <description>&lt;P&gt;Sorry for the confusion... The FullVaccin is the fieldname on AGOL while Join_Count is for the original table in ArcPro..... and the table has not be joined with another table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;($feature.Calculation * 1000)/Join_Count&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This works but did not give the accurate percentage&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:54:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166326#M54266</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T18:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166334#M54267</link>
      <description>&lt;P&gt;Whenever I use the&amp;nbsp;&lt;EM&gt;(Sum($feature.Join_Count))&amp;nbsp;&lt;/EM&gt;It returns the exact value for each row&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 19:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166334#M54267</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T19:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166373#M54271</link>
      <description>&lt;P&gt;Hmmm... odd.&amp;nbsp; This code works in AGOL, and if I edit the Layer through a feature service in Pro (this is different test data, but the same code as I originally sent structure wise)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var myid = $feature.Work_Unit_No
var mysum = 0
var myfs = filter(featuresetbyname($datastore,"TestPoints",['TestInt'],false),'Work_Unit_No = @myid')
if(!IsEmpty(myfs)){
  var mysum = Round(($feature.TestInt/Sum(myfs,'TestInt'))*100,2)
}
return mysum&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason your original code returned 1 every time was because it divided any number it found by itself:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;$feature.FullVaccin / Sum($feature.FullVaccin)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So a tweak to the original code would be to create a feature set (in my example below called myfs) and pass that into the Sum function.&amp;nbsp; If I want the myfs feature set to return all the rows in the Layer's table I can just remove the filter from my original response.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1650485008866.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39488iA2FDD7FC1F8D92F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1650485008866.png" alt="KimGarbade_0-1650485008866.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var myid = $feature.COJ_FacilityID
var mysum = 0
var myfs = featuresetbyname($datastore,"BogusPumps",['Integer1'],false)
if(!IsEmpty(myfs)){
  var mysum = ($feature.Integer1/Sum(myfs,'Integer1'))
}
return mysum&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If this doesn't work, I'm afraid I'm missing something that is right in front of me, but I just can't put my finger on.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 20:06:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166373#M54271</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-20T20:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sum() returning Nan Value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166393#M54275</link>
      <description>&lt;P&gt;Thanks so much&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 20:44:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sum-returning-nan-value/m-p/1166393#M54275</guid>
      <dc:creator>godofsix</dc:creator>
      <dc:date>2022-04-20T20:44:53Z</dc:date>
    </item>
  </channel>
</rss>

