<?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 Arcade expression to calculate percentage in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103066#M42352</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to calculate the percentage of properties that are multiple occupancy.&lt;/P&gt;&lt;P&gt;There are 3 Layers required to do this&lt;/P&gt;&lt;P&gt;1) Multiple Occupancy (Points)&lt;/P&gt;&lt;P&gt;2) Addresses (Points)&lt;/P&gt;&lt;P&gt;3) Zones (Polygons)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMcDonald_0-1632922252402.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24133i42AE2D73780ED51C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CMcDonald_0-1632922252402.png" alt="CMcDonald_0-1632922252402.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have created 2 expressions in the Zones Layer so that in the pop-up they 'count' the number of properties in both point Layers&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMcDonald_1-1632922356433.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24135iD90FC131A30D9501/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CMcDonald_1-1632922356433.png" alt="CMcDonald_1-1632922356433.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can I create another expression in the Zones Layer that will in effect&lt;/P&gt;&lt;P&gt;Multiple Occupancy Count / Address Count * 100&lt;/P&gt;&lt;P&gt;So that I can get a %&lt;/P&gt;&lt;P&gt;This is my arcade but the % returned although does not error is not the correct figure&amp;nbsp;&lt;/P&gt;&lt;P&gt;//count multiple occupancy properties&lt;BR /&gt;var hmo = FeatureSetByName($map, 'Houses in Multiple Occupation HMO')&lt;BR /&gt;var countHMO = Count(Intersects(hmo, $feature))&lt;BR /&gt;return countHMO&lt;BR /&gt;//count addresses&lt;BR /&gt;var address = FeatureSetByName($map,"CAG OldAbdn Sample")&lt;BR /&gt;var countAddress = Count(Intersects(address,$feature))&lt;BR /&gt;return countAddress&lt;BR /&gt;//calculate % of multiple occupancy&lt;BR /&gt;($feature["countHMO"]/$feature["countAddress"])*100&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Sep 2021 14:16:36 GMT</pubDate>
    <dc:creator>CMcDonald</dc:creator>
    <dc:date>2021-09-29T14:16:36Z</dc:date>
    <item>
      <title>Arcade expression to calculate percentage</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103066#M42352</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to calculate the percentage of properties that are multiple occupancy.&lt;/P&gt;&lt;P&gt;There are 3 Layers required to do this&lt;/P&gt;&lt;P&gt;1) Multiple Occupancy (Points)&lt;/P&gt;&lt;P&gt;2) Addresses (Points)&lt;/P&gt;&lt;P&gt;3) Zones (Polygons)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMcDonald_0-1632922252402.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24133i42AE2D73780ED51C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CMcDonald_0-1632922252402.png" alt="CMcDonald_0-1632922252402.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have created 2 expressions in the Zones Layer so that in the pop-up they 'count' the number of properties in both point Layers&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMcDonald_1-1632922356433.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24135iD90FC131A30D9501/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CMcDonald_1-1632922356433.png" alt="CMcDonald_1-1632922356433.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can I create another expression in the Zones Layer that will in effect&lt;/P&gt;&lt;P&gt;Multiple Occupancy Count / Address Count * 100&lt;/P&gt;&lt;P&gt;So that I can get a %&lt;/P&gt;&lt;P&gt;This is my arcade but the % returned although does not error is not the correct figure&amp;nbsp;&lt;/P&gt;&lt;P&gt;//count multiple occupancy properties&lt;BR /&gt;var hmo = FeatureSetByName($map, 'Houses in Multiple Occupation HMO')&lt;BR /&gt;var countHMO = Count(Intersects(hmo, $feature))&lt;BR /&gt;return countHMO&lt;BR /&gt;//count addresses&lt;BR /&gt;var address = FeatureSetByName($map,"CAG OldAbdn Sample")&lt;BR /&gt;var countAddress = Count(Intersects(address,$feature))&lt;BR /&gt;return countAddress&lt;BR /&gt;//calculate % of multiple occupancy&lt;BR /&gt;($feature["countHMO"]/$feature["countAddress"])*100&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 14:16:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103066#M42352</guid>
      <dc:creator>CMcDonald</dc:creator>
      <dc:date>2021-09-29T14:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to calculate percentage</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103104#M42357</link>
      <description>&lt;OL&gt;&lt;LI&gt;You need to remove the return statements. If you return from a function, everything after the statement is not executed.&lt;/LI&gt;&lt;LI&gt;Arcade expressions don't know of each other. You cant call $feature["countHMO"], because that calls a field that does not exist. You have to calculate countHMO &amp;amp; countAddress again and use them for calculating the percentage.&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="javascript"&gt;//count multiple occupancy properties
var hmo = FeatureSetByName($map, 'Houses in Multiple Occupation HMO')
var countHMO = Count(Intersects(hmo, $feature))
//return countHMO
//count addresses
var address = FeatureSetByName($map,"CAG OldAbdn Sample")
var countAddress = Count(Intersects(address,$feature))
//return countAddress
//calculate % of multiple occupancy
return (countHMO/countAddress)*100&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Sep 2021 14:56:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103104#M42357</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-09-29T14:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to calculate percentage</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103128#M42361</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;, that worked perfectly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I wonder (if I may ask), is it possible/is there any value adding a 'round' statement?&lt;/P&gt;&lt;P&gt;When you test the expression it returns many decimal places&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMcDonald_0-1632929694404.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24148i17A5AB26F7F893E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CMcDonald_0-1632929694404.png" alt="CMcDonald_0-1632929694404.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;however I can control the appearance through Configure Pop-up &amp;gt; Configure Attributes. I just wondered if you rounded in advance if that would increase performance?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 15:37:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103128#M42361</guid>
      <dc:creator>CMcDonald</dc:creator>
      <dc:date>2021-09-29T15:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to calculate percentage</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103375#M42369</link>
      <description>&lt;P&gt;I don't know if it increases the performance (although I guess the effect would be minimal in either way), but&amp;nbsp; you can round:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return Round((countHMO/countAddress)*100, 2)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Sep 2021 06:01:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103375#M42369</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-09-30T06:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to calculate percentage</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103390#M42372</link>
      <description>&lt;P&gt;Cool.&amp;nbsp; Thanks again for your help, much appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 08:19:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-calculate-percentage/m-p/1103390#M42372</guid>
      <dc:creator>CMcDonald</dc:creator>
      <dc:date>2021-09-30T08:19:11Z</dc:date>
    </item>
  </channel>
</rss>

