<?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 Calculating an Arcade Expression from Two Different Feature Layers in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-an-arcade-expression-from-two/m-p/1130318#M5602</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I'm trying to calculate the percent change in population between different hosted feature layers in a web map for a dashboard indicator. I am unfamiliar with Arcade but below is what I have pieced together so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;var starYear = FeatureSetByName($map, 'Census City Blocks 2020')
var tenYear = FeatureSetByName($map,'Census City Blocks 2010')

var tenYearPop = {'fields': [{'name': 'Total_Pop', 'type': 'esriFieldTypeInteger'}], 
                    'geometryType': '', 'features': []}; 

var todayPop = {'fields': [{'name': 'Total_Pop', 'type': 'esriFieldTypeInteger'}], 
                    'geometryType': '', 'features': []};

var tenYearChange = round(((todayPop-tenYearPop)/todayPop)*100, 2) +'%'
return tenYearChange&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result of the code above is shown below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Arcade.png" style="width: 713px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30709iB85BED3964119F40/image-size/large?v=v2&amp;amp;px=999" role="button" title="Arcade.png" alt="Arcade.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result should be 5.98%. The field name for the population for both feature layers is Total_Pop. Any idea on how to calculate this?&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jan 2022 15:09:06 GMT</pubDate>
    <dc:creator>Dylan_Wingler</dc:creator>
    <dc:date>2022-01-04T15:09:06Z</dc:date>
    <item>
      <title>Calculating an Arcade Expression from Two Different Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-an-arcade-expression-from-two/m-p/1130318#M5602</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I'm trying to calculate the percent change in population between different hosted feature layers in a web map for a dashboard indicator. I am unfamiliar with Arcade but below is what I have pieced together so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;var starYear = FeatureSetByName($map, 'Census City Blocks 2020')
var tenYear = FeatureSetByName($map,'Census City Blocks 2010')

var tenYearPop = {'fields': [{'name': 'Total_Pop', 'type': 'esriFieldTypeInteger'}], 
                    'geometryType': '', 'features': []}; 

var todayPop = {'fields': [{'name': 'Total_Pop', 'type': 'esriFieldTypeInteger'}], 
                    'geometryType': '', 'features': []};

var tenYearChange = round(((todayPop-tenYearPop)/todayPop)*100, 2) +'%'
return tenYearChange&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result of the code above is shown below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Arcade.png" style="width: 713px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30709iB85BED3964119F40/image-size/large?v=v2&amp;amp;px=999" role="button" title="Arcade.png" alt="Arcade.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result should be 5.98%. The field name for the population for both feature layers is Total_Pop. Any idea on how to calculate this?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 15:09:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-an-arcade-expression-from-two/m-p/1130318#M5602</guid>
      <dc:creator>Dylan_Wingler</dc:creator>
      <dc:date>2022-01-04T15:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Arcade Expression from Two Different Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-an-arcade-expression-from-two/m-p/1130329#M5604</link>
      <description>&lt;P&gt;Those variables &lt;STRONG&gt;todayPop&lt;/STRONG&gt; and &lt;STRONG&gt;tenYearPop&lt;/STRONG&gt; are just dictionaries with nothing in their &lt;STRONG&gt;features&lt;/STRONG&gt; array. So for one thing, they're not FeatureSets, and for another, there's literally nothing in them to calculate values for. You need some way of either populating those and converting them to actual FeatureSets, or else you need to perform the calculation against the &lt;STRONG&gt;starYear&lt;/STRONG&gt; and &lt;STRONG&gt;tenYear&lt;/STRONG&gt; FeatureSets you've already brought in.&lt;/P&gt;&lt;P&gt;Another thing: in a dashboard data expression, you can't reference the &lt;STRONG&gt;$map&lt;/STRONG&gt;, you've got to use the &lt;STRONG&gt;FeatureSetByPortalItem&lt;/STRONG&gt; function to bring in any layers you're working with.&lt;/P&gt;&lt;P&gt;If you're unfamiliar with Arcade, it can seem like quite a lot, but check out some of the &lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/CombineMultipleLayers(SerialChart).md" target="_self"&gt;sample dashboard expressions&lt;/A&gt; to get you started.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 15:24:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-an-arcade-expression-from-two/m-p/1130329#M5604</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-01-04T15:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Arcade Expression from Two Different Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-an-arcade-expression-from-two/m-p/1130451#M5615</link>
      <description>&lt;P&gt;Can&amp;nbsp;&lt;STRONG&gt;FeatureSetByPortalItem&lt;/STRONG&gt; use ArcGIS Online hosted feature layers?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 18:09:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-an-arcade-expression-from-two/m-p/1130451#M5615</guid>
      <dc:creator>Dylan_Wingler</dc:creator>
      <dc:date>2022-01-04T18:09:05Z</dc:date>
    </item>
  </channel>
</rss>

