<?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: Calculate percentile with Arcade expression for pop up in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/calculate-percentile-with-arcade-expression-for/m-p/1083005#M41407</link>
    <description>&lt;P&gt;Thank you so much!!!!&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 11:58:08 GMT</pubDate>
    <dc:creator>GraceAnneIngham</dc:creator>
    <dc:date>2021-07-27T11:58:08Z</dc:date>
    <item>
      <title>Calculate percentile with Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/calculate-percentile-with-arcade-expression-for/m-p/1082406#M41379</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how to calculate a percentile using an arcade string for a pop-up in ArcGIS Online?&lt;/P&gt;&lt;P&gt;I am working on data for Glynn county Georgia and have percentages such as percent minority for each census block. I would like for the pop up to display the percentile that the block falls within the county: ex. this census block is in the 90th percentile for minority population.&lt;/P&gt;&lt;P&gt;Does anyone know how to write a script that does this? I am completely new to Arcade.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 23:37:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/calculate-percentile-with-arcade-expression-for/m-p/1082406#M41379</guid>
      <dc:creator>GraceAnneIngham</dc:creator>
      <dc:date>2021-07-23T23:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentile with Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/calculate-percentile-with-arcade-expression-for/m-p/1082829#M41400</link>
      <description>&lt;P&gt;This should be straightforward enough but does depend on the input data. I'll use an&lt;A href="https://kendall.maps.arcgis.com/home/item.html?id=45ede6d6ff7e4cbbbffa60d34227e462" target="_self"&gt; ACS household income layer&lt;/A&gt; in my example. In particular, I'm going to get the percentile rank of a given census tract based on the attribute &lt;STRONG&gt;B19053_002E&lt;/STRONG&gt;, which is the number of households reporting self-employment income.&lt;/P&gt;&lt;P&gt;The formula for percentile for a value X is &lt;STRONG&gt;[number of values &amp;lt; X] / total number of values]&lt;/STRONG&gt;. In an Arcade expression, it looks like the following. Note that I'm including a &lt;STRONG&gt;Filter&lt;/STRONG&gt; function to only get percentiles for a single county.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// The value to get the percentile for
var value = $feature["B19053_002E"]

// The subset of the GEOID referring to state and county
// We insert the SQL wildcard "%" here, as the Filter parameter seems to have a problem with using it there
var county_id = Left($feature["GEOID"], 5) + "%"

// Census tracts. Only getting two relevant fields, no geometry.
var tracts = FeatureSetByName(
    $map,
    "ACS Median Household Income Variables - Boundaries - Tract",
    ["GEOID", "B19053_002E"],
    false)
    
// Filter tracts by matching county ID
var county_tracts = Filter(tracts, "GEOID LIKE @county_id")

// Filter again for values below clicked feature
var below_tracts = Filter(county_tracts, "B19053_002E &amp;lt; @value")

// Calculate percentile
var percentile = Count(below_tracts)/Count(county_tracts)
return Text(percentile, '#.00%')&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1627334553266.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19372i579C4A1EBE3F2BA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1627334553266.png" alt="jcarlson_0-1627334553266.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 21:22:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/calculate-percentile-with-arcade-expression-for/m-p/1082829#M41400</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-07-26T21:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentile with Arcade expression for pop up</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/calculate-percentile-with-arcade-expression-for/m-p/1083005#M41407</link>
      <description>&lt;P&gt;Thank you so much!!!!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 11:58:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/calculate-percentile-with-arcade-expression-for/m-p/1083005#M41407</guid>
      <dc:creator>GraceAnneIngham</dc:creator>
      <dc:date>2021-07-27T11:58:08Z</dc:date>
    </item>
  </channel>
</rss>

