<?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 Calculating Range With Arcade Expressions for Indicators in Dashboards Beta in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-range-with-arcade-expressions-for/m-p/1026326#M4180</link>
    <description>&lt;P&gt;I'm creating a dashboard to display monthly statistics from weekly pump station inspections.&amp;nbsp; I need to calculate the range for the field, &lt;STRONG&gt;Run Hours&lt;/STRONG&gt;.&amp;nbsp; Aka I'd like to take the Max value minus the Min Value.&amp;nbsp; Below is a snippet of the data I'm working with.&amp;nbsp; I have a category selector that will filter the Table based off a date range and specific pump station.&amp;nbsp; Without the category selector, the expression&amp;nbsp;Max($datapoint["RunHours"]) returns the overall max value for the field.&amp;nbsp; However when I apply the category selector, it only spits out the minimum value from the queried range of values.&amp;nbsp; So it seems&amp;nbsp; like it's not properly calculating the max value once I apply the category selector.&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Pump Station #&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Run Hours&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/2/21&lt;/TD&gt;&lt;TD&gt;718.60&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/9/21&lt;/TD&gt;&lt;TD&gt;(Blank or Null)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/20/21&lt;/TD&gt;&lt;TD&gt;719.50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1/15/21&lt;/TD&gt;&lt;TD&gt;500.0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After setting the category selector to Pump Station 1 for the month of January, these are my results&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Expression&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Expected Result&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Actual Result&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;719.5&lt;/TD&gt;&lt;TD&gt;718.6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Min($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;718.6&lt;/TD&gt;&lt;TD&gt;718.6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max($datapoint["RunHours"])&amp;nbsp;&lt;STRONG&gt;-&amp;nbsp;&lt;/STRONG&gt;Min($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;0.9&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max($datapoint["RunHours"])&amp;nbsp;&lt;STRONG&gt;+&amp;nbsp;&lt;/STRONG&gt;Min($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;1438.1&lt;/TD&gt;&lt;TD&gt;1437.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the first expression I tried resulting in 0.&amp;nbsp; (see the line starting with "middleText..")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;return {
    textColor:'',
    backgroundColor:'',
    topText: 'Generator Run Hours',
    topTextColor: '',
    topTextOutlineColor: '',
    topTextMaxSize: 'medium',
    middleText: Max($datapoint["RunHours"])-Min($datapoint["RunHours"]),
    middleTextColor: '',
    middleTextOutlineColor: '',
    middleTextMaxSize: 'large',
    //bottomText: '',
    //bottomTextColor: '',
    //bottomTextOutlineColor: '',
    //bottomTextMaxSize: 'medium',
    //iconName:'',
    //iconAlign:'left',
    //iconColor:'',
    //iconOutlineColor:'',
    //noValue:false,
    //attributes: {
      // attribute1: '',
      // attribute2: ''
    // }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the second expression I've tried, also resulting in 0.&amp;nbsp;(see the line starting with "middleText..")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var maxhrs = Max($datapoint["RunHours"])
var minhrs = Min($datapoint["RunHours"])

return {
    textColor:'',
    backgroundColor:'',
    topText: 'Generator Run Hours',
    topTextColor: '',
    topTextOutlineColor: '',
    topTextMaxSize: 'medium',
    middleText: maxhrs-minhrs,
    middleTextColor: '',
    middleTextOutlineColor: '',
    middleTextMaxSize: 'large',
    //bottomText: '',
    //bottomTextColor: '',
    //bottomTextOutlineColor: '',
    //bottomTextMaxSize: 'medium',
    //iconName:'',
    //iconAlign:'left',
    //iconColor:'',
    //iconOutlineColor:'',
    //noValue:false,
    //attributes: {
      // attribute1: '',
      // attribute2: ''
    // }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will someone review my arcade expressions and help me figure out what the issue is? I'm unsure if the Null is messing things up, if it is, how do I tell it to ignore the Nulls?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; Tagging you because you seemed to help others with related issues.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Feb 2021 16:04:17 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-02-12T16:04:17Z</dc:date>
    <item>
      <title>Calculating Range With Arcade Expressions for Indicators in Dashboards Beta</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-range-with-arcade-expressions-for/m-p/1026326#M4180</link>
      <description>&lt;P&gt;I'm creating a dashboard to display monthly statistics from weekly pump station inspections.&amp;nbsp; I need to calculate the range for the field, &lt;STRONG&gt;Run Hours&lt;/STRONG&gt;.&amp;nbsp; Aka I'd like to take the Max value minus the Min Value.&amp;nbsp; Below is a snippet of the data I'm working with.&amp;nbsp; I have a category selector that will filter the Table based off a date range and specific pump station.&amp;nbsp; Without the category selector, the expression&amp;nbsp;Max($datapoint["RunHours"]) returns the overall max value for the field.&amp;nbsp; However when I apply the category selector, it only spits out the minimum value from the queried range of values.&amp;nbsp; So it seems&amp;nbsp; like it's not properly calculating the max value once I apply the category selector.&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Pump Station #&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Run Hours&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/2/21&lt;/TD&gt;&lt;TD&gt;718.60&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/9/21&lt;/TD&gt;&lt;TD&gt;(Blank or Null)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/20/21&lt;/TD&gt;&lt;TD&gt;719.50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1/15/21&lt;/TD&gt;&lt;TD&gt;500.0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After setting the category selector to Pump Station 1 for the month of January, these are my results&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Expression&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Expected Result&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Actual Result&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;719.5&lt;/TD&gt;&lt;TD&gt;718.6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Min($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;718.6&lt;/TD&gt;&lt;TD&gt;718.6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max($datapoint["RunHours"])&amp;nbsp;&lt;STRONG&gt;-&amp;nbsp;&lt;/STRONG&gt;Min($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;0.9&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max($datapoint["RunHours"])&amp;nbsp;&lt;STRONG&gt;+&amp;nbsp;&lt;/STRONG&gt;Min($datapoint["RunHours"])&lt;/TD&gt;&lt;TD&gt;1438.1&lt;/TD&gt;&lt;TD&gt;1437.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the first expression I tried resulting in 0.&amp;nbsp; (see the line starting with "middleText..")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;return {
    textColor:'',
    backgroundColor:'',
    topText: 'Generator Run Hours',
    topTextColor: '',
    topTextOutlineColor: '',
    topTextMaxSize: 'medium',
    middleText: Max($datapoint["RunHours"])-Min($datapoint["RunHours"]),
    middleTextColor: '',
    middleTextOutlineColor: '',
    middleTextMaxSize: 'large',
    //bottomText: '',
    //bottomTextColor: '',
    //bottomTextOutlineColor: '',
    //bottomTextMaxSize: 'medium',
    //iconName:'',
    //iconAlign:'left',
    //iconColor:'',
    //iconOutlineColor:'',
    //noValue:false,
    //attributes: {
      // attribute1: '',
      // attribute2: ''
    // }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the second expression I've tried, also resulting in 0.&amp;nbsp;(see the line starting with "middleText..")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var maxhrs = Max($datapoint["RunHours"])
var minhrs = Min($datapoint["RunHours"])

return {
    textColor:'',
    backgroundColor:'',
    topText: 'Generator Run Hours',
    topTextColor: '',
    topTextOutlineColor: '',
    topTextMaxSize: 'medium',
    middleText: maxhrs-minhrs,
    middleTextColor: '',
    middleTextOutlineColor: '',
    middleTextMaxSize: 'large',
    //bottomText: '',
    //bottomTextColor: '',
    //bottomTextOutlineColor: '',
    //bottomTextMaxSize: 'medium',
    //iconName:'',
    //iconAlign:'left',
    //iconColor:'',
    //iconOutlineColor:'',
    //noValue:false,
    //attributes: {
      // attribute1: '',
      // attribute2: ''
    // }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will someone review my arcade expressions and help me figure out what the issue is? I'm unsure if the Null is messing things up, if it is, how do I tell it to ignore the Nulls?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; Tagging you because you seemed to help others with related issues.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 16:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-range-with-arcade-expressions-for/m-p/1026326#M4180</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-12T16:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Range With Arcade Expressions for Indicators in Dashboards Beta</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-range-with-arcade-expressions-for/m-p/1026605#M4186</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I wish I had an answer for you, but I don't have a lot of experience in using Arcade in the Dashboard. I tried some stuff in the beginning, but it was limited to accessing data in the datapoint only and therefore I haven't used it very much. I have heard that you will be able to use Arcade as data source and that should increment the possibilities to a whole new level (can't wait for that).&lt;/P&gt;&lt;P&gt;What it seems like, is that you just have access to the first datapoint, although filtering for Pump station 1 should get you 3 values. The other thing is how Arcade will treat Null values. have a look at the example below. If a list contains a null value, the value will be treated as 0, in my example, this will return an invalid min statistic and also an invalid average statistic.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;[1,2,3,4,5,null]
min:0
max:5
sum:15
avg:2.5&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 21:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-range-with-arcade-expressions-for/m-p/1026605#M4186</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-13T21:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Range With Arcade Expressions for Indicators in Dashboards Beta</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-range-with-arcade-expressions-for/m-p/1026843#M4187</link>
      <description>&lt;P&gt;Thanks for your input!&amp;nbsp; My coworker was able to figure out a workaround to get the results we need.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We set the value to the minimum statistic for the "Run Hours" field.&lt;/P&gt;&lt;P&gt;Then we turned on the Reference and set that to the Maximum Statistic for the "Run Hours" field.&lt;/P&gt;&lt;P&gt;Then I references the value and reference value to perform the calculation I needed to get the Range.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var maxhrs = $reference["max_RunHours"]
var minhrs = $datapoint["min_RunHours"]
var rangehrs = maxhrs-minhrs

return {
    textColor:'',
    backgroundColor:'',
    topText: 'Generator Run Hours',
    topTextColor: '',
    topTextOutlineColor: '',
    topTextMaxSize: 'medium',
    middleText: round(rangehrs,1),
    middleTextColor: '',
    middleTextOutlineColor: '',
    middleTextMaxSize: 'large',
    //bottomText: '',
    //bottomTextColor: '',
    //bottomTextOutlineColor: '',
    //bottomTextMaxSize: 'medium',
    //iconName:'',
    //iconAlign:'left',
    //iconColor:'',
    //iconOutlineColor:'',
    //noValue:false,
    //attributes: {
      // attribute1: '',
      // attribute2: ''
    // }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 13:27:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/calculating-range-with-arcade-expressions-for/m-p/1026843#M4187</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-15T13:27:29Z</dc:date>
    </item>
  </channel>
</rss>

