<?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: How to use DateDiff function with custom dates in Dashboard in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300058#M7964</link>
    <description>&lt;P&gt;Hey Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do something similar to this. I am trying to determine the Age of an item based on the Date difference from Today to a Date in an attribute field. I would like this to work as either an Indicator or a Gauge. I appreciate any help you can provide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//var Days from start to date&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;endDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Today&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;startDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;PurDate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;age&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DateDiff&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;endDate&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;startDate&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'days'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;age&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 16 Jun 2023 00:14:09 GMT</pubDate>
    <dc:creator>AndyMinor2</dc:creator>
    <dc:date>2023-06-16T00:14:09Z</dc:date>
    <item>
      <title>How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1298815#M7934</link>
      <description>&lt;P&gt;I'm building an indicator in dashboard. What I would like to show is the current velocity &amp;amp; the velocity required to finish by year end in 'mi'.&lt;/P&gt;&lt;P&gt;I've got the current velocity working, sort of. In order to keep that working and get the the second velocity working I need DateDiff to work with manually entered dates. All the examples I see link it to date fields in the feature using $feature, but for this purpose those dates are irrelevant.&lt;/P&gt;&lt;P&gt;The 138 is my remaining working days and that is currently manually entered, thus I need the var age to generate this number instead. (var remainingDays = 138) You can see father down (age) is showing the NaN in topText:&lt;/P&gt;&lt;P&gt;I my project started 3-27-23 and times out 12-31-23. I'm wondering if the problem is the output format of the Date vs Day(Now()).&lt;/P&gt;&lt;P&gt;See screenshot for context.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="wAlexPage_0-1686684778462.png" style="width: 705px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73099i817B5CA6688DA998/image-dimensions/705x426?v=v2" width="705" height="426" role="button" title="wAlexPage_0-1686684778462.png" alt="wAlexPage_0-1686684778462.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; endDate = &lt;SPAN class=""&gt;Date&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'12/31/2023'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;'MM/DD/YYYY'&lt;/SPAN&gt;)
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; startDate = &lt;SPAN class=""&gt;Day&lt;/SPAN&gt;(&lt;SPAN class=""&gt;Now&lt;/SPAN&gt;())
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; age = &lt;SPAN class=""&gt;DateDiff&lt;/SPAN&gt;(endDate, startDate,&lt;SPAN class=""&gt;'days'&lt;/SPAN&gt;)

&lt;SPAN class=""&gt;var&lt;/SPAN&gt; remainingDays = &lt;SPAN class=""&gt;138&lt;/SPAN&gt;
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; totalProduction = $datapoint[&lt;SPAN class=""&gt;"sum_Miles"&lt;/SPAN&gt;]  &lt;SPAN class=""&gt;// Actual total production to date&lt;/SPAN&gt;
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; totalDays = &lt;SPAN class=""&gt;192&lt;/SPAN&gt;  &lt;SPAN class=""&gt;// The actual total number of days avalible&lt;/SPAN&gt;

&lt;SPAN class=""&gt;var&lt;/SPAN&gt; projectedVelocity = totalProduction / (totalDays - remainingDays)

&lt;SPAN class=""&gt;return&lt;/SPAN&gt; {
    &lt;SPAN class=""&gt;//textColor:'',&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;//backgroundColor:'',&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;topText&lt;/SPAN&gt;: (age),
    &lt;SPAN class=""&gt;//topTextColor: '',&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;//topTextOutlineColor: '',&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;//topTextMaxSize: 'medium',&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;middleText&lt;/SPAN&gt;: &lt;SPAN class=""&gt;Round&lt;/SPAN&gt; (projectedVelocity,&lt;SPAN class=""&gt;3&lt;/SPAN&gt;)+&lt;SPAN class=""&gt;"mi"&lt;/SPAN&gt;,&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2023 19:34:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1298815#M7934</guid>
      <dc:creator>wAlexPage</dc:creator>
      <dc:date>2023-06-13T19:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1299035#M7937</link>
      <description>&lt;P&gt;Your startDate isn't a date, because you're extracting the current day...&lt;/P&gt;&lt;P&gt;You can also use Today() instead of Now() to get full days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var endDate = Date('12/31/2023','MM/DD/YYYY')
var startDate = Today()
var age = DateDiff(endDate, startDate,'days')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 07:40:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1299035#M7937</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-06-14T07:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1299159#M7942</link>
      <description>&lt;P&gt;Thank you very much for your assistance! I wanted to take a few and clean up the expression for everyone to benefit from. it worked beautifully.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="wAlexPage_0-1686751560161.png" style="width: 773px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73191i073D3053C7B1F64C/image-dimensions/773x394?v=v2" width="773" height="394" role="button" title="wAlexPage_0-1686751560161.png" alt="wAlexPage_0-1686751560161.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I got rid a place where it was duplicating one of the variables and swapped out one of the others to subtract 'nonWorkDays' giving us more control over how many days were actually available.&lt;/P&gt;&lt;P&gt;Thank you again&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;Alex&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 14:10:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1299159#M7942</guid>
      <dc:creator>wAlexPage</dc:creator>
      <dc:date>2023-06-14T14:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1299164#M7943</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Here's what I was doing with it.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="wAlexPage_0-1686777408074.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73265iF757307818943591/image-size/medium?v=v2&amp;amp;px=400" role="button" title="wAlexPage_0-1686777408074.png" alt="wAlexPage_0-1686777408074.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//var Days from start to date&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;endDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Today&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;startDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Date&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'03/27/2023'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'MM/DD/YYYY'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;ytdDays&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DateDiff&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;endDate&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;startDate&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'days'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Actual total production to date&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;totalProduction&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$Datapoint&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"sum_Miles"&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// The actual total number of days avalible&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;nonWorkDays&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;22&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;actualVelocity&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;totalProduction&lt;/SPAN&gt;&lt;SPAN&gt; / (&lt;/SPAN&gt;&lt;SPAN&gt;ytdDays&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;nonWorkDays&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;return actualVelocity&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//Good Luck&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Jun 2023 21:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1299164#M7943</guid>
      <dc:creator>wAlexPage</dc:creator>
      <dc:date>2023-06-14T21:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300058#M7964</link>
      <description>&lt;P&gt;Hey Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do something similar to this. I am trying to determine the Age of an item based on the Date difference from Today to a Date in an attribute field. I would like this to work as either an Indicator or a Gauge. I appreciate any help you can provide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//var Days from start to date&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;endDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Today&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;startDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;PurDate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;age&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DateDiff&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;endDate&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;startDate&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'days'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;age&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Jun 2023 00:14:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300058#M7964</guid>
      <dc:creator>AndyMinor2</dc:creator>
      <dc:date>2023-06-16T00:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300089#M7965</link>
      <description>&lt;P&gt;Hey Andy,&lt;/P&gt;&lt;P&gt;I think we don't have enough information to help here. If this is for a Dashboard, the first thing I'd mention is the gauge won't have the access to Arcade that indicator does.&lt;/P&gt;&lt;P&gt;The next thing is if you look back at my expression the primary data I'm pulling is sum_Miles, this is a virtual item being compiled by the indicator on the Data tab. I don't have a feature called this, it's from telling the indicator to sum the miles field.&lt;/P&gt;&lt;P&gt;I don't believe you can pull something else (CreationDate) from $datapoint if it's already being used. You said you want to tell the age of something with an indicator, but yours is likely like mine in that this supports some other expresion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is that? Is something else already using $datapoint? I've been playing with mine for a while now and I'm still stuck.&lt;/P&gt;&lt;P&gt;This isn't saying much though because I'm very new to all this, about a year in. I'll be back at the desk in the morning. G'night, Alex&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 04:41:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300089#M7965</guid>
      <dc:creator>AlexPage</dc:creator>
      <dc:date>2023-06-16T04:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300449#M7967</link>
      <description>&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry. Yes, a Dashboard. I was trying to use your Arcade expression since it does something similar to what I am trying to do. I am trying to make an Indicator that tracks how old my chickens are for butchering. I have an attribute field for the date the chicks hatched and want to keep track of their age and butcher around 8-10 weeks old. Then I will log the data using my QuickCapture app and see the weight, cost and dates for tracking production. I was hoping to use a Gauge to act like a fuel gauge and reach full when they are done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried creating the date variables and pulling the date field from the $datapoint but didn't have any luck. I'm still trying to learn Arcade. Thanks for the help.&lt;/P&gt;&lt;P&gt;Andy&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="chicken-ops-dash.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73541i8DF9D788C6AC6CA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chicken-ops-dash.jpg" alt="chicken-ops-dash.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 23:42:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300449#M7967</guid>
      <dc:creator>AndyMinor2</dc:creator>
      <dc:date>2023-06-16T23:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300472#M7968</link>
      <description>&lt;P&gt;Andy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I love this, I want to see you achieve this! We'll pick up next week. I grew up in the country and we did broilers too.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2023 00:53:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300472#M7968</guid>
      <dc:creator>AlexPage</dc:creator>
      <dc:date>2023-06-17T00:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300473#M7969</link>
      <description>&lt;P&gt;Here's my QC app.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2023 01:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1300473#M7969</guid>
      <dc:creator>AndyMinor2</dc:creator>
      <dc:date>2023-06-17T01:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DateDiff function with custom dates in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1301114#M7982</link>
      <description>&lt;P&gt;Wanted to bring this one home for everyone here.&lt;/P&gt;&lt;P&gt;To complete the indicators I needed to exclude the company holidays and weekends. This was being achieved through a manual entry above, but I wanted it scripted.&lt;/P&gt;&lt;P&gt;I worked with one of great folks at Esri, Paul Barker who gave me a direction to go, then took what I made and actually made it work. I was using normal dates, not starting at month 0, and attempting a for loop, but his 'while' statement looks so great, and is easier to get my head around.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What it does:&lt;/STRONG&gt; Divides production / working days, by removing non-working days to create project velocity, and shows you the remaining days to the deadline. To create the actual velocity, just flip flip the initial variables.&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// array of holiday dates (note Month is a zero indexed value)
var holiDates = [
  Date(2023, 0, 2),
  Date(2023, 3, 7),
  Date(2023, 4, 29),
  Date(2023, 6, 4),
  Date(2023, 10, 23),
  Date(2023, 10, 24),
  Date(2023, 11, 25),
  Date(2023, 11, 26)
];

//set up initial variables
var todayDate = Today();
var counter = 0;
var endDate = Date(2023, 6, 15); // End date of project

//iterate over the range and count the work days 
while (todayDate &amp;lt;= endDate) {
  var currWeekDay = Weekday(todayDate);
  var isWorkDay = currWeekDay &amp;gt; 0 &amp;amp;&amp;amp; currWeekDay &amp;lt; 6;
  var isHoliday = Includes(holiDates, todayDate);

  // check that its a work day and not a holiday and if so count it
  if (isWorkDay &amp;amp;&amp;amp; !isHoliday) {
        counter += 1;
  }
  todayDate = DateAdd(todayDate, 1, "days");
}

// Starting total project miles
var startMiles = 112.3

// Actual total production to date
var ytdProduction = $Datapoint["sum_Miles"]

var requiredVelocity = (startMiles - ytdProduction) / counter;

return {
  //textColor:'',
  //backgroundColor:'',
  topText: (counter)+" "+"Work Days Remain",
  topTextColor: 'red',
  topTextOutlineColor: 'red',
  topTextMaxSize: 'medium',
  middleText: Round (requiredVelocity,3)+"mi",
  middleTextColor: 'orange',
  middleTextOutlineColor: 'red',
  middleTextMaxSize: 'medium',
  //bottomText: '',
  //bottomTextColor: '',
  //bottomTextOutlineColor: '',
  //bottomTextMaxSize: 'small',
  //iconName:'',
  iconAlign:'left',
  iconColor:'Orange',
  iconOutlineColor:'red',
  //noValue:false,
  //attributes: {
    // attribute1: '',
    // attribute2: ''
  // }
}&lt;/LI-CODE&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="AlexPage_0-1687276227897.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73707i0634A9BA1CDAD5F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexPage_0-1687276227897.png" alt="AlexPage_0-1687276227897.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks Paul!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 15:54:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-use-datediff-function-with-custom-dates-in/m-p/1301114#M7982</guid>
      <dc:creator>AlexPage</dc:creator>
      <dc:date>2023-06-20T15:54:59Z</dc:date>
    </item>
  </channel>
</rss>

