<?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: Help with Arcade expression (percentage change) in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143536#M51385</link>
    <description>&lt;P&gt;Hi Duncan, no each location is unique for the month.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Feb 2022 09:46:55 GMT</pubDate>
    <dc:creator>JoshNock1</dc:creator>
    <dc:date>2022-02-14T09:46:55Z</dc:date>
    <item>
      <title>Help with Arcade expression (percentage change)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1142983#M51314</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am looking for some assistance with an arcade expression to use on ArcPro to find the percentage change of a dataset month by month.&lt;/P&gt;&lt;P&gt;I have provided an example dataset below.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;Location&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;Grand Total&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;London&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;2&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Dec_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;New York&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;7&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Dec_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Paris&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;8&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Dec_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;London&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;3&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Nov_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;New York&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;7&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Nov_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Paris&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;3&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Nov_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;London&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;1&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Oct_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;New York&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Oct_2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Paris&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;9&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Oct_2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe the result should be as below&lt;/P&gt;&lt;TABLE border="1" width="578px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;&lt;STRONG&gt;Location&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="160.484px"&gt;&lt;STRONG&gt;Grand Total&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="85.3281px"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="169.625px"&gt;&lt;STRONG&gt;Percentage change (%)&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;London&lt;/TD&gt;&lt;TD width="160.484px"&gt;2&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Dec_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;-33.33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;New York&lt;/TD&gt;&lt;TD width="160.484px"&gt;7&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Dec_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;Paris&lt;/TD&gt;&lt;TD width="160.484px"&gt;8&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Dec_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;167.67&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;London&lt;/TD&gt;&lt;TD width="160.484px"&gt;3&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Nov_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;New York&lt;/TD&gt;&lt;TD width="160.484px"&gt;7&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Nov_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;Paris&lt;/TD&gt;&lt;TD width="160.484px"&gt;3&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Nov_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;-66.67&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;London&lt;/TD&gt;&lt;TD width="160.484px"&gt;1&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Oct_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;n/a&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;New York&lt;/TD&gt;&lt;TD width="160.484px"&gt;4&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Oct_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;n/a&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="161.562px"&gt;Paris&lt;/TD&gt;&lt;TD width="160.484px"&gt;9&lt;/TD&gt;&lt;TD width="85.3281px"&gt;Oct_2021&lt;/TD&gt;&lt;TD width="169.625px"&gt;n/a&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The general formula I used is below, but looking for a way to automate this as I have thousands of rows of data&lt;/P&gt;&lt;P&gt;((Nov_2021)-(Dec_2021))/(Nov_2021))*100&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 09:48:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1142983#M51314</guid>
      <dc:creator>JoshNock1</dc:creator>
      <dc:date>2022-02-11T09:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Arcade expression (percentage change)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143096#M51327</link>
      <description>&lt;P&gt;Can a location exist more than once within a single month?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 16:19:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143096#M51327</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2022-02-11T16:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Arcade expression (percentage change)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143129#M51330</link>
      <description>&lt;P&gt;One option to automate this is create a model in ModelBuilder using your inputs and the Calculate Field GP tool.&amp;nbsp; You can either use Python or Arcade expression for the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-field-examples.htm" target="_self"&gt;Calculate Field GP&lt;/A&gt; tool parameter.&amp;nbsp; To automate it, export it out from ModelBuilder as a Python script and associate the *.py script with a Basic Task in Windows Task Scheduler to run every x amount of time.&amp;nbsp; You can also &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/modelbuilder/scheduling-a-model-run.htm" target="_self"&gt;schedule a model &lt;/A&gt;to run regularly too.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 16:59:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143129#M51330</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2022-02-11T16:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Arcade expression (percentage change)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143536#M51385</link>
      <description>&lt;P&gt;Hi Duncan, no each location is unique for the month.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 09:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143536#M51385</guid>
      <dc:creator>JoshNock1</dc:creator>
      <dc:date>2022-02-14T09:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Arcade expression (percentage change)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143554#M51388</link>
      <description>&lt;P&gt;The first step is to simplify your input otherwise you would need some complex logic to identify as you step through the table you have gone from&amp;nbsp;Paris Dec_2021 to&amp;nbsp;London Nov_2021.&lt;/P&gt;&lt;P&gt;If your input is truly structured as you have shown then you could very easily explode out this table using the Split by attributes tool.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DuncanHornby_0-1644836755175.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33828i6C6A8AA7ACE2F65A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DuncanHornby_0-1644836755175.png" alt="DuncanHornby_0-1644836755175.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This creates as many tables as you have locations, the output of one such table would be:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DuncanHornby_1-1644836814401.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33829i99C71342C1EBB8AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DuncanHornby_1-1644836814401.png" alt="DuncanHornby_1-1644836814401.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Depending upon your input structure you may need to sort the table into a correct date sequence.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Add a new field of type double to record your change then run the following python code in a field calculate tool&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="DuncanHornby_2-1644838982804.png" style="width: 401px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33830i38A69098F637BF44/image-dimensions/401x528?v=v2" width="401" height="528" role="button" title="DuncanHornby_2-1644838982804.png" alt="DuncanHornby_2-1644838982804.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code block is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;l = list() # remember lists start at index zero
with arcpy.da.SearchCursor("London","GrandTotal") as cur:
    for row in cur:
        l.append(row[0])
        
def offset(i,currentTotal):
    global l
    if i &amp;lt; len(l):
        prev_month = l[i]
        calc = ((currentTotal - prev_month) / prev_month)*100
        return calc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example above I have hardwired it to read the table "London" but you could easily swap that out with an inline variable substitution from a model iterator as suggested by&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2538"&gt;@Robert_LeClair&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 12:17:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression-percentage-change/m-p/1143554#M51388</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2022-02-14T12:17:37Z</dc:date>
    </item>
  </channel>
</rss>

