<?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: List Data Expression with Arcade in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/list-data-expression-with-arcade/m-p/1374121#M8978</link>
    <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;, I thought the advanced formatting was just for the visual format, didn't realize I could use a calculation and then add {expression/duration}&amp;nbsp; in the config.&amp;nbsp; This worked perfectly!!!&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jan 2024 20:34:52 GMT</pubDate>
    <dc:creator>LindseyStone</dc:creator>
    <dc:date>2024-01-24T20:34:52Z</dc:date>
    <item>
      <title>List Data Expression with Arcade</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/list-data-expression-with-arcade/m-p/1373935#M8975</link>
      <description>&lt;P&gt;I'm trying to create a data expression in the List of a Dashboard to pull statistics from the different status of several features.&amp;nbsp; I have set the Group By expression on my status field and calculated the SUM on many of the fields and have that working.&amp;nbsp; The part I can't figure out is I want to determine the duration taken to complete the entire project for each category.&amp;nbsp; So I need to take the lowest start date from all the features in said category and the highest end date from the same category and Difference them.&amp;nbsp; So in each category I know how many days it took overall.&amp;nbsp; Note, some features start date or end date may overlap as we would have one person starting and ending in one area, and another person starting and ending in a different area at different times.&lt;/P&gt;&lt;P&gt;This is what I have so far, I just don't how to fit the variable durationcalc into the group by so it returns it as part of the table for each category.&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;//Define Portal Item and Fields
var fs = FeatureSetByPortalItem(Portal('portal'), 'item', feature, ['surveystatus','belowleaks1','belowleaks2','belowleaks3','aboveleaks1','aboveleaks2','aboveleaks3','footagemains','numberservices','startdate','enddate'],false);
//define duration
var sdate = Min(fs, 'startdate');
var edate = Max(fs, 'enddate');
var durationcalc = DateDiff(edate, sdate, 'days');
//Group By Survey Status and calc Sums on leaks
return GroupBy(fs, ['surveystatus'], [ 
    { name: 'Underground Leaks Class 1', expression: 'belowleaks1', statistic: 'SUM' }, 
    { name: 'Underground Leaks Class 2', expression: 'belowleaks2', statistic: 'SUM' },
    { name: 'Underground Leaks Class 3', expression: 'belowleaks3', statistic: 'SUM' },
    { name: 'Aboveground Leaks Class 1', expression: 'aboveleaks1', statistic: 'SUM' },
    { name: 'Aboveground Leaks Class 2', expression: 'aboveleaks2', statistic: 'SUM' },
    { name: 'Aboveground Leaks Class 3', expression: 'aboveleaks3', statistic: 'SUM' },
    { name: 'Miles of Main', expression: 'footagemains', statistic: 'SUM' },
    { name: 'Num of Services', expression: 'numberservices', statistic: 'SUM' },
    //Determine the earliest start date of all features and the latest end date of all features
    { name: 'Start Date', expression: 'startdate', statistic: 'MIN' },
    { name: 'End Date', expression: 'enddate', statistic: 'MAX' },])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 16:10:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/list-data-expression-with-arcade/m-p/1373935#M8975</guid>
      <dc:creator>LindseyStone</dc:creator>
      <dc:date>2024-01-24T16:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: List Data Expression with Arcade</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/list-data-expression-with-arcade/m-p/1373947#M8977</link>
      <description>&lt;P&gt;So, you will probably have trouble getting a duration out of this expression directly. But you don't need the duration to be in the table in order to show it!&lt;/P&gt;&lt;P&gt;Given that you have a start and end date correctly being calculated for each category, you can use Arcade advanced formatting in the list configuration itself to show the DateDiff there.&lt;/P&gt;&lt;P&gt;In the advanced formatting:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return {
  attributes: {
    duration: DateDiff($datapoint['End Date'], $datapoint['Start Date'], 'days')
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the list configuration, reference &lt;STRONG&gt;{expressions/duration} &lt;/STRONG&gt;to bring that value into what is shown.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 16:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/list-data-expression-with-arcade/m-p/1373947#M8977</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-01-24T16:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: List Data Expression with Arcade</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/list-data-expression-with-arcade/m-p/1374121#M8978</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;, I thought the advanced formatting was just for the visual format, didn't realize I could use a calculation and then add {expression/duration}&amp;nbsp; in the config.&amp;nbsp; This worked perfectly!!!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 20:34:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/list-data-expression-with-arcade/m-p/1374121#M8978</guid>
      <dc:creator>LindseyStone</dc:creator>
      <dc:date>2024-01-24T20:34:52Z</dc:date>
    </item>
  </channel>
</rss>

