<?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 Count Multiple Layers Data Expression in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/count-multiple-layers-data-expression/m-p/1549684#M10409</link>
    <description>&lt;P&gt;I'm trying to come up with a data expression to create a bar graph to simply show the count (number of records) within 5 different data layers. The layers represent the same type of data, just range from records from 2020-2024.&lt;/P&gt;&lt;P&gt;I'd like to end up with something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ONMaps_0-1729194592488.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117496i5095AAD0456FF7D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ONMaps_0-1729194592488.png" alt="ONMaps_0-1729194592488.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for any guidance!&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2024 19:50:34 GMT</pubDate>
    <dc:creator>ONMaps</dc:creator>
    <dc:date>2024-10-17T19:50:34Z</dc:date>
    <item>
      <title>Count Multiple Layers Data Expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/count-multiple-layers-data-expression/m-p/1549684#M10409</link>
      <description>&lt;P&gt;I'm trying to come up with a data expression to create a bar graph to simply show the count (number of records) within 5 different data layers. The layers represent the same type of data, just range from records from 2020-2024.&lt;/P&gt;&lt;P&gt;I'd like to end up with something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ONMaps_0-1729194592488.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117496i5095AAD0456FF7D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ONMaps_0-1729194592488.png" alt="ONMaps_0-1729194592488.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for any guidance!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 19:50:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/count-multiple-layers-data-expression/m-p/1549684#M10409</guid>
      <dc:creator>ONMaps</dc:creator>
      <dc:date>2024-10-17T19:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count Multiple Layers Data Expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/count-multiple-layers-data-expression/m-p/1549919#M10410</link>
      <description>&lt;P&gt;There's a GitHub site that contains many different types of data expressions for Dashboard, including &lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard/dashboard_data/CombineMultipleLayers(SerialChart).md" target="_self"&gt;one&lt;/A&gt; showing how to combine different dataset.&lt;/P&gt;&lt;P&gt;Here's a script that combines two different dataset, each with a Date field. I'm selecting all the dates that aren't null to populate the table. You can expand this to your five data sets.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal("your portal");
var fs1 = FeatureSetByPortalItem(
  portal,
  "itemId for first dataset",
  0,
  ["Date"],
  false
);
var fs2 = FeatureSetByPortalItem(
  portal,
  "itemId for first dataset",
  0,
  ["Date"],
  false
);
var features = [];
var feat;

function populateFeatures(fs) {
  for (var i in fs) {
    if (!IsEmpty(i.Date)) {
      feat = { attributes: { Year: Year(i.Date) } };
      Push(features, feat);
    }
  }
}

var featureSets = [fs1, fs2]

for (var fs in featureSets) {
  console(featureSets[fs])
  populateFeatures(featureSets[fs]);
}

var combinedDict = {
  fields: [{ name: "Year", type: "esriFieldTypeInteger" }],
  geometryType: "",
  features: features
};

return FeatureSet(combinedDict);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_6d4b20.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117542i17C1657F9FCB754E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_6d4b20.png" alt="Snag_6d4b20.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 14:03:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/count-multiple-layers-data-expression/m-p/1549919#M10410</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-10-18T14:03:08Z</dc:date>
    </item>
  </channel>
</rss>

