<?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 Data Expression Help in Dashboard in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-help-in-dashboard/m-p/1383074#M9067</link>
    <description>&lt;P&gt;Hello, I'm fairly new to Arcade and I'm trying to build a data expression inside a gauge on Dashboard. I'm able to navigate to my portal layer using the following code:&lt;/P&gt;&lt;P&gt;var p = Portal("Organization Portal");&lt;BR /&gt;var feature = FeatureSetByPortalItem(p, "Item ID", Layer ID);&lt;/P&gt;&lt;P&gt;Now I'm trying to apply a filter to the layer. The following is what was applied to my feature layer in ArcGIS Pro as a whole before publishing as a web map. My goal is to build a gauge for each date range in order to track the counts. How would I do that here? Thanks.&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested within a year from today&lt;BR /&gt;if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;lt; 365)&lt;BR /&gt;{return "Tested within a year from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested over a year from today&lt;BR /&gt;else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;gt;= 365 &amp;amp;&amp;amp;&lt;BR /&gt;DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;lt; 730)&lt;BR /&gt;{return "Tested over a year from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested over two years from today&lt;BR /&gt;else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;gt;= 730 &amp;amp;&amp;amp;&lt;BR /&gt;DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;lt; 1460)&lt;BR /&gt;{return "Tested over two years from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested over three years from today&lt;BR /&gt;else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;gt;= 1460)&lt;BR /&gt;{return "Tested over three years from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were never tested&lt;BR /&gt;else&lt;BR /&gt;{return "No ISO information"}&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2024 20:09:43 GMT</pubDate>
    <dc:creator>JustinCallahan</dc:creator>
    <dc:date>2024-02-15T20:09:43Z</dc:date>
    <item>
      <title>Data Expression Help in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-help-in-dashboard/m-p/1383074#M9067</link>
      <description>&lt;P&gt;Hello, I'm fairly new to Arcade and I'm trying to build a data expression inside a gauge on Dashboard. I'm able to navigate to my portal layer using the following code:&lt;/P&gt;&lt;P&gt;var p = Portal("Organization Portal");&lt;BR /&gt;var feature = FeatureSetByPortalItem(p, "Item ID", Layer ID);&lt;/P&gt;&lt;P&gt;Now I'm trying to apply a filter to the layer. The following is what was applied to my feature layer in ArcGIS Pro as a whole before publishing as a web map. My goal is to build a gauge for each date range in order to track the counts. How would I do that here? Thanks.&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested within a year from today&lt;BR /&gt;if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;lt; 365)&lt;BR /&gt;{return "Tested within a year from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested over a year from today&lt;BR /&gt;else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;gt;= 365 &amp;amp;&amp;amp;&lt;BR /&gt;DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;lt; 730)&lt;BR /&gt;{return "Tested over a year from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested over two years from today&lt;BR /&gt;else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;gt;= 730 &amp;amp;&amp;amp;&lt;BR /&gt;DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;lt; 1460)&lt;BR /&gt;{return "Tested over two years from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were flow tested over three years from today&lt;BR /&gt;else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') &amp;gt;= 1460)&lt;BR /&gt;{return "Tested over three years from today"}&lt;/P&gt;&lt;P&gt;//hydrants that were never tested&lt;BR /&gt;else&lt;BR /&gt;{return "No ISO information"}&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 20:09:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-help-in-dashboard/m-p/1383074#M9067</guid>
      <dc:creator>JustinCallahan</dc:creator>
      <dc:date>2024-02-15T20:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Data Expression Help in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-help-in-dashboard/m-p/1383123#M9068</link>
      <description>&lt;P&gt;Here's an example of how to filter your data by time. This filters recent earthquakes, returning quakes between one and two months ago.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var p = Portal("https://www.arcgis.com");
var fs = FeatureSetByPortalItem(p, '9e2f2b544c954fda9cd13b7f3e6eebce', 0, ['eventTime'])
var time1 = Dateadd(Today(), -1, 'month')
var time2 = Dateadd(Today(), -2, 'month')
var sql = `eventTime &amp;lt; '${time1}' and eventTime &amp;gt; '${time2}'`
return Filter(fs, sql)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 Feb 2024 21:14:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-help-in-dashboard/m-p/1383123#M9068</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-02-15T21:14:08Z</dc:date>
    </item>
  </channel>
</rss>

