<?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: Apply date range selector to filter indicators with data expressions in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1364344#M8889</link>
    <description>&lt;P&gt;Hi Josh, this worked amazingly. Thank you SO much. I think I wasn't sure how it would address the date range, but I see now that the date range selector is compatible in that it can filter the table to pull all features that apply. Thank you again.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Dec 2023 19:55:57 GMT</pubDate>
    <dc:creator>Tiff</dc:creator>
    <dc:date>2023-12-26T19:55:57Z</dc:date>
    <item>
      <title>Apply date range selector to filter indicators with data expressions</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1359039#M8840</link>
      <description>&lt;P&gt;I have custom data expressions for indicators to sum up various fields in my feature layer. The expression is written by creating a dictionary for all the fields that I want to eventually filter by through category selectors. These are all either integer or string fields, like "County Name" or "Year".&lt;/P&gt;&lt;P&gt;Is it possible to incorporate a date range selector that would somehow be compatible with the category selector filter actions? Since each selector's filter actions asks for a source and target field, I'm finding it difficult to figure out if this type of interaction is possible. Any thoughts appreciated, thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 12:53:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1359039#M8840</guid>
      <dc:creator>Tiff</dc:creator>
      <dc:date>2023-12-11T12:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Apply date range selector to filter indicators with data expressions</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1359080#M8841</link>
      <description>&lt;P&gt;It's important to remember that an Indicator widget can do the summing for you.&lt;/P&gt;&lt;P&gt;When you return a sum in the Data Expression, any other non-summed fields are stripped out, and you can't filter by them. Instead, try returning a Data Expression with a single row per item. Then set the Indicator to show a Statistic and choose &lt;STRONG&gt;Sum&lt;/STRONG&gt;. The underlying data can have per-item date values, and thus be filtered by a date selector.&lt;/P&gt;&lt;P&gt;This would be easier to advise on with your expression. Can you share it?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 14:20:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1359080#M8841</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-12-11T14:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Apply date range selector to filter indicators with data expressions</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1359285#M8842</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;, thanks for chiming in! I wonder if the calculation I am doing would work with how you are describing using the Indicator widget. Not only am I summing up fields, I am also applying other dynamic calculations, for example, multiplying one field by another or a specific value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a shortened expression example after pulling in the item from Portal, in which the two category selector in this case would be watershed and group name. I wasn't able to figure out how to incorporate this into an Indicator, which is why I went the data expression route.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;combinedDict&lt;/SPAN&gt;&lt;SPAN&gt; = {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"fields"&lt;/SPAN&gt;&lt;SPAN&gt;: [&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&am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gt;</description>
      <pubDate>Mon, 11 Dec 2023 19:00:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1359285#M8842</guid>
      <dc:creator>Tiff</dc:creator>
      <dc:date>2023-12-11T19:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Apply date range selector to filter indicators with data expressions</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1364102#M8886</link>
      <description>&lt;P&gt;A date selector just needs a date field to act against, so you should just be able to include a date field in the expression. Define the date field in your &lt;STRONG&gt;combinedDict&lt;/STRONG&gt; object, then pull the date field in from the feature in your loop later.&lt;/P&gt;&lt;P&gt;If this is on Portal, you'll need to use &lt;STRONG&gt;Number &lt;/STRONG&gt;to get your date to come through correctly.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var combinedDict = {
  "fields": [
    {'name': 'WATERSHED','type':'esriFieldTypeString'},
    {'name': 'GROUP_NAME','type':'esriFieldTypeString'},
    {'name': 'Weights','type':'esriFieldTypeInteger'},
    {'name': 'some_date', type: 'esriFieldTypeDate'}
  ],
  "geometryType": "",
  "features": []
}

var i = 0
for (var f in fs) {
  combinedDict.features[i++] = {
    "attributes": {
      "WATERSHED": f["WATERSHED"],
      "GROUP_NAME": f["GROUP_NAME"],
      "Weights": f["FIELD_1"] * 25 + f["FIELD_2"] * 22 + f["FIELD_3"] * f["FIELD_4"],
      some_date: Number(f['some_date'])
  }
}
var result = FeatureSet(Text(combinedDict))
return result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Once your featureset has a date field in it, any date selector should be able to act against it.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 20:41:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1364102#M8886</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-12-22T20:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Apply date range selector to filter indicators with data expressions</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1364344#M8889</link>
      <description>&lt;P&gt;Hi Josh, this worked amazingly. Thank you SO much. I think I wasn't sure how it would address the date range, but I see now that the date range selector is compatible in that it can filter the table to pull all features that apply. Thank you again.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 19:55:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/apply-date-range-selector-to-filter-indicators/m-p/1364344#M8889</guid>
      <dc:creator>Tiff</dc:creator>
      <dc:date>2023-12-26T19:55:57Z</dc:date>
    </item>
  </channel>
</rss>

