<?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: Unable to return distinct count in Arcade data expression in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265539#M7460</link>
    <description>&lt;P&gt;Data expressions need to return a &lt;STRONG&gt;FeatureSet&lt;/STRONG&gt;. The Indicator can handle the &lt;STRONG&gt;Count&lt;/STRONG&gt; portion, so just return &lt;STRONG&gt;Distinct(fs, 'site')&lt;/STRONG&gt;, then configure the widget.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2023 16:52:18 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2023-03-08T16:52:18Z</dc:date>
    <item>
      <title>Unable to return distinct count in Arcade data expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265492#M7458</link>
      <description>&lt;P&gt;I have an Arcade data expression I'm trying to set as the source for an indicator widget in a dashboard on our Enterprise Portal. This expression should return a count of distinct sites in a hosted feature layer, e.g. 5 distinct sites from 684 records.&lt;/P&gt;&lt;P&gt;The expression below works in the expression editor, returning a Number type of 5, but the Source tab shows an error icon with the message 'Unable to execute Arcade expression'. It seems like this should be a relatively simple expression. All clues and help appreciated, thanks.&lt;/P&gt;&lt;P&gt;Credit to&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;, expression based on answer&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-web-appbuilder-questions/finding-distinct-features-using-arcade-in-list/td-p/1153506" target="_blank" rel="noopener"&gt;here.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var ptl = Portal('https://portal_url/')
var fs = FeatureSetByPortalItem(
    ptl,
    'itemid',
    0,
    ['site'],
    false
    );
    
return Count(Distinct(fs, 'site'))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 15:48:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265492#M7458</guid>
      <dc:creator>ZenMasterZeke</dc:creator>
      <dc:date>2023-03-08T15:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to return distinct count in Arcade data expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265539#M7460</link>
      <description>&lt;P&gt;Data expressions need to return a &lt;STRONG&gt;FeatureSet&lt;/STRONG&gt;. The Indicator can handle the &lt;STRONG&gt;Count&lt;/STRONG&gt; portion, so just return &lt;STRONG&gt;Distinct(fs, 'site')&lt;/STRONG&gt;, then configure the widget.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 16:52:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265539#M7460</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-03-08T16:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to return distinct count in Arcade data expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265595#M7461</link>
      <description>&lt;P&gt;Thanks! Works great. Don't know why it worked in the expression editor but not elsewhere, but good enough.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 17:51:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265595#M7461</guid>
      <dc:creator>ZenMasterZeke</dc:creator>
      <dc:date>2023-03-08T17:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to return distinct count in Arcade data expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265631#M7462</link>
      <description>&lt;P&gt;Well, the expression editor will return anything so long as the expression is valid. You could have the expression &lt;STRONG&gt;Boolean()&lt;/STRONG&gt; and it would return a value. It's when the expression is being loaded by the Dashboard that it looks for the FeatureSet.&lt;/P&gt;&lt;P&gt;Similarly, the Popup editor will return a FeatureSet, but when the popup evaluates the expression, it's looking for something it can render as text or HTML, and a FeatureSet will just show up as [Object object] or something.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 18:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/unable-to-return-distinct-count-in-arcade-data/m-p/1265631#M7462</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-03-08T18:37:09Z</dc:date>
    </item>
  </channel>
</rss>

