<?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: Frequency using Arcade in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068861#M11137</link>
    <description>&lt;P&gt;It gets a bit complicated with two polygon layers, but however you do it, you'll need to run a few more things in the expression. Unfortunately, you can't run &lt;STRONG&gt;Intersects&lt;/STRONG&gt; between two FeatureSets, so we'll need to use a loop.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Intersect poles w/ clicked polygon&lt;/LI&gt;&lt;LI&gt;Intersect clicked polygon w/ second polygon layer&lt;/LI&gt;&lt;LI&gt;For each intersected second polygon, get the subset of intersected points&lt;/LI&gt;&lt;LI&gt;Aggregate results from 3&lt;/LI&gt;&lt;/OL&gt;&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;&lt;LI-CODE lang="c"&gt;var poles = FeatureSetByName($map, "Poles")
var grids = FeatureSetByName($map, "Inspection Grid")

var xs_pts = Intersects(poles, $feature)
var xs_grid = Intersects(grids, $feature)

var out_count = 0

for (var g in xs_grid){
    var sub_count = Count(Intersects(xs_pts, g))
    Console(`${sub_count} in ${g}`)
    out_count += sub_count
}

return out_count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a sample running against US states, cities, and a scratch layer:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1623849355930.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16093i9DA6847DC3F6CD60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1623849355930.png" alt="jcarlson_0-1623849355930.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;jcarlson_0-1623849355930.png&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_1-1623849370644.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16094iA63B5CD3ABACC0F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_1-1623849370644.png" alt="jcarlson_1-1623849370644.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;jcarlson_1-1623849370644.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wanted a per-grid breakdown, that's doable as well, but this will work for a simple count.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jun 2021 13:17:12 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2021-06-16T13:17:12Z</dc:date>
    <item>
      <title>Frequency using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068823#M11135</link>
      <description>&lt;P&gt;I'm looking to get the frequency of points within 2 polygons in my map's pop ups.&amp;nbsp;&lt;/P&gt;&lt;P&gt;points -&amp;gt; poles&lt;/P&gt;&lt;P&gt;polygon 1 -&amp;gt; inspection grids (filtering on inspection year)&lt;/P&gt;&lt;P&gt;polygon 2 -&amp;gt; municipalities&lt;/P&gt;&lt;P&gt;set up: Our engineering group would like to compare the number of poles to be inspected with the completed inspections.&amp;nbsp; Poles are inspected by grids, but they need the count within the municipality for permitting.&amp;nbsp; I have been able to get the count of poles in each grid and the count of poles in each municipality, but I can't seem to figure out how to get the count of poles to be inspected (in the grids) by municipality.&lt;/P&gt;&lt;P&gt;In ArcMap/Pro, I would complete this task by the following workflow:&lt;/P&gt;&lt;P&gt;-Select by Location: select poles within the grids (this produces the poles to be inspected)&lt;/P&gt;&lt;P&gt;-Spatial Join: the selected poles to be inspected within the municipalities&lt;/P&gt;&lt;P&gt;-Frequency: the number of poles to be inspected in each municipality&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;current expression being used to get the&amp;nbsp;count of poles by muni:&lt;/P&gt;&lt;P&gt;var poles = FeatureSetByName($map,"Poles")&lt;BR /&gt;var polesInMuni = Count(Intersects(poles,$feature))&lt;/P&gt;&lt;P&gt;return polesInMuni&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached a snip of a highlighted muni, let's call it "Home".&amp;nbsp; the blue dots that fall within Home and the 2 overlapping grids are the ones I need to count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:46:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068823#M11135</guid>
      <dc:creator>AJohns17</dc:creator>
      <dc:date>2021-06-16T11:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068861#M11137</link>
      <description>&lt;P&gt;It gets a bit complicated with two polygon layers, but however you do it, you'll need to run a few more things in the expression. Unfortunately, you can't run &lt;STRONG&gt;Intersects&lt;/STRONG&gt; between two FeatureSets, so we'll need to use a loop.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Intersect poles w/ clicked polygon&lt;/LI&gt;&lt;LI&gt;Intersect clicked polygon w/ second polygon layer&lt;/LI&gt;&lt;LI&gt;For each intersected second polygon, get the subset of intersected points&lt;/LI&gt;&lt;LI&gt;Aggregate results from 3&lt;/LI&gt;&lt;/OL&gt;&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;&lt;LI-CODE lang="c"&gt;var poles = FeatureSetByName($map, "Poles")
var grids = FeatureSetByName($map, "Inspection Grid")

var xs_pts = Intersects(poles, $feature)
var xs_grid = Intersects(grids, $feature)

var out_count = 0

for (var g in xs_grid){
    var sub_count = Count(Intersects(xs_pts, g))
    Console(`${sub_count} in ${g}`)
    out_count += sub_count
}

return out_count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a sample running against US states, cities, and a scratch layer:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1623849355930.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16093i9DA6847DC3F6CD60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1623849355930.png" alt="jcarlson_0-1623849355930.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;jcarlson_0-1623849355930.png&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_1-1623849370644.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16094iA63B5CD3ABACC0F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_1-1623849370644.png" alt="jcarlson_1-1623849370644.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;jcarlson_1-1623849370644.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wanted a per-grid breakdown, that's doable as well, but this will work for a simple count.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 13:17:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068861#M11137</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-06-16T13:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068919#M11140</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;but it's not working properly.&amp;nbsp; after plugging in my data, I get a number but the count doesn't match what I get in ArcMap using the previously mentioned process.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AJohns17_2-1623855687816.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16107i3A52AA1BC3834C18/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AJohns17_2-1623855687816.png" alt="AJohns17_2-1623855687816.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AJohns17_2-1623855687816.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AJohns17_0-1623855629220.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16105iDFFBB076155A44D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AJohns17_0-1623855629220.png" alt="AJohns17_0-1623855629220.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AJohns17_0-1623855629220.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 15:01:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068919#M11140</guid>
      <dc:creator>AJohns17</dc:creator>
      <dc:date>2021-06-16T15:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068930#M11141</link>
      <description>&lt;P&gt;Have you done a visual count to verify what the number is supposed to be? Also, note that using &lt;STRONG&gt;$feature &lt;/STRONG&gt;in Arcade may produce inaccurate results depending on the scale of your map and how close intersecting features may be to the edge. Do you get different results at larger/smaller scales?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 15:12:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068930#M11141</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-06-16T15:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068953#M11144</link>
      <description>&lt;P&gt;here is a visual of one area:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AJohns17_0-1623859546907.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16116i2AD0455B82A767ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AJohns17_0-1623859546907.png" alt="AJohns17_0-1623859546907.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AJohns17_0-1623859546907.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the selected line is of a muni boundary, the green is the grid and i added a red dot to each of the poles.&amp;nbsp; 6 are shown but the expression is only reading 5.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 16:07:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/frequency-using-arcade/m-p/1068953#M11144</guid>
      <dc:creator>AJohns17</dc:creator>
      <dc:date>2021-06-16T16:07:05Z</dc:date>
    </item>
  </channel>
</rss>

