<?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: Calculate  Function Won't Update with New Values in ArcGIS Collector Questions</title>
    <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1146566#M13595</link>
    <description>&lt;P&gt;Thank you so so much. It worked!!! But now I have another issue.&amp;nbsp; In the dashboard I am using the list element and I want to sort the complaint count from high to low, but since the expression doesn't create a field I can't use the function that is in the element.&amp;nbsp; After research I found I could use an order by on the FeatureSetByName, however, in the dashboard that isn't an option to use the FeatureSetByName. I see there is a Sort in the dashboard -&amp;nbsp;&lt;SPAN&gt;Sort&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;inputArray&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;, comparator )&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;returns&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;{ Array }.&amp;nbsp; Would it accept expression/total?&amp;nbsp; Thinking out loud, I want it to sort my expression and return any greater than 5, but I am not sure how to make this work in Arcade.&amp;nbsp; Help again would be appreciated. Also what does this mean {Array}. Here is my stab at it. Thank you.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Sort (expression/total, &amp;gt; 5 ) returns { Array }&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Feb 2022 17:09:22 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2022-02-22T17:09:22Z</dc:date>
    <item>
      <title>Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145697#M13581</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using Enterprise 10.9.1.&amp;nbsp; I have created a Field Map App and using Collector on desktop.&amp;nbsp; When a new complaint is entered in the app, I would like for the total count of complaints to automatically update. But it doesn't.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the mapviewer/Enterprise, I created a new field and used the calculate function to count all complaints.&amp;nbsp; When I enter the calculate function it works great - thanks to this forum. But when I add a NEW complaint in the app, the total count doesn't update. I have to go back to map viewer and re do the calculate function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assumed this would update automatically, but after reading about SQL and the calculate function it states "one of the most common calculations you perform is to derive a new numeric value based on existing values in your feature layer." I think existing values is the key word. I want it to update on new values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions. It was suggested to use python as a script, but since I am using map viewer in the Enterprise that is not an option. Plus only a beginner at python.&lt;/P&gt;&lt;P&gt;Has anyone else come across this? Any idea what to do? Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 17:42:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145697#M13581</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-18T17:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145708#M13582</link>
      <description>&lt;P&gt;Can you clarify: is the "complaint count" an attribute on your &lt;STRONG&gt;features&lt;/STRONG&gt;? And if there are 20 complaints, is that field being set to "20" for all of them?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 17:57:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145708#M13582</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T17:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145714#M13583</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Yes "complaint count" (total number of complaints) is an attribute on my hosted feature layer.&amp;nbsp; Ideally, it adds the complaints every time a complaint is entered. But in reality, it only adds them when I re enter the SQL expression in the calculate field in the "complaint count" attribute.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnnettePoole1_0-1645207321420.png" style="width: 522px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34362i8D8B58EC26D956C2/image-dimensions/522x200?v=v2" width="522" height="200" role="button" title="AnnettePoole1_0-1645207321420.png" alt="AnnettePoole1_0-1645207321420.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 18:03:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145714#M13583</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-18T18:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145722#M13584</link>
      <description>&lt;P&gt;Got it. And what' the context in which you need this number? Since this is an in-row calculation, most any of the Arcade profiles should be able to handle it, even the Symbology profile.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sum_fields = [
    $feature.some_field,
    $feature.another_field,
    ect...
]

var total = 0

for (var s in sum_fields){
    If (!IsEmpty(sum_fields[s])){
        total += 1
    }
}

return total&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 18:14:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145722#M13584</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T18:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145732#M13585</link>
      <description>&lt;P&gt;The calculation in SQL works fine, just doesn't update when a NEW complaint is added. Plus it appears I cannot use Arcade as an option.&amp;nbsp; Note it states that Arcade cannot be used because Sync enabled or does not have editing enabled.&amp;nbsp; Both layers I unchecked Sync enabled and both are editable. So I am not sure why its not allowing me to use Arcade. At any rate, the SQL expression works except for NEW values.&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="AnnettePoole1_0-1645208710532.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34365iAE28A3B8C893FE9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnnettePoole1_0-1645208710532.png" alt="AnnettePoole1_0-1645208710532.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 18:26:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145732#M13585</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-18T18:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145744#M13586</link>
      <description>&lt;P&gt;Sorry, I mean why does this number need to be a static field? Where are you using its value where an expression couldn't be used instead?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 18:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145744#M13586</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T18:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145791#M13587</link>
      <description>&lt;P&gt;Great questions.&amp;nbsp; I don't want it to be static, I want it to be dynamic if I understand what you are asking.&amp;nbsp; I created an app for use in Collector and Field Maps.&amp;nbsp; I wanted the user to be able to go to the address, open complaints and see a total number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't wan the user to have to count them add enter it themselves, hence the calculate field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating using the calculate field in enterprise map viewer so expressions aren't an option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;A few options, maybe I could bring the layer to ArcPRO and create the expression. OR just show the total number of complaints on a dashboard and create the expression in the dashboard, although it would be nice for them to be able to see it in the app as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you saying if I use an expression instead of SQL I would be able to dynamically update? Thank you.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnnettePoole1_0-1645217219932.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34385i42E622ADD18938E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnnettePoole1_0-1645217219932.png" alt="AnnettePoole1_0-1645217219932.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 20:50:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145791#M13587</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-18T20:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145794#M13588</link>
      <description>&lt;P&gt;To be clear, the &lt;STRONG&gt;field &lt;/STRONG&gt;will not be dynamic.&lt;/P&gt;&lt;P&gt;But if it would be okay for the "total complaint count" to be in the popup or the form's title, you could easily use Arcade in those places with the expression I posted above, and the expression evaluates when the feature is clicked or the form is loaded.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 20:54:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145794#M13588</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T20:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145883#M13589</link>
      <description>&lt;P&gt;Here's what I did. And of course any help is appreciated with item 3 below.&lt;/P&gt;&lt;P&gt;1. I know this wasn't the intention, but I wanted to try it. I brought the layer into ArcPRO to test Arcade expression above. It worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; I then tried it in the map viewer and I got this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnnettePoole1_0-1645223480879.png" style="width: 608px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34441i8713EDF918B2685D/image-dimensions/608x266?v=v2" width="608" height="266" role="button" title="AnnettePoole1_0-1645223480879.png" alt="AnnettePoole1_0-1645223480879.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3. Then I tried in the dashboard Arcade, but this is what I got. I did change the field names to the correct field names, hence the $datapoint. I don't know enough to know what is wrong. Any&amp;nbsp; help is appreciated.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnnettePoole1_1-1645223963576.png" style="width: 287px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34442i941C55177B629F9F/image-dimensions/287x452?v=v2" width="287" height="452" role="button" title="AnnettePoole1_1-1645223963576.png" alt="AnnettePoole1_1-1645223963576.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 22:39:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145883#M13589</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-18T22:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145893#M13590</link>
      <description>&lt;P&gt;So, in a dashboard's Advanced Formatting profile, your expression will have to go &lt;EM&gt;above &lt;/EM&gt;the &lt;STRONG&gt;return&lt;/STRONG&gt; section.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Your expression

var total = 0

... etc ...

// The return. Unless you need to change the background / text color based on some attribute, you can leave those off.

return {
   attributes: {
     total: total
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in your list item's formatting, reference your custom attribute as &lt;STRONG&gt;{expression/total} &lt;/STRONG&gt;and you'll see it populate in the list.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1645225490819.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34446iB0844FD4CE7A204E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1645225490819.png" alt="jcarlson_0-1645225490819.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 23:04:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145893#M13590</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T23:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145894#M13591</link>
      <description>&lt;P&gt;By the way, I don't know what's going on with the map viewer...&lt;/P&gt;&lt;P&gt;Did you try adding this as a custom expression to the feature popup?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 23:05:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145894#M13591</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T23:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145902#M13592</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&amp;nbsp; I am learning a lot! I appreciate it.&amp;nbsp; Yes, it did work in the configure pop up! Dashboard not quite getting it. Thank you for your&amp;nbsp; help on the dashboard, I have viewed a lot of videos but most skip over the easy stuff and its assumed I know how to do this.&lt;/P&gt;&lt;P&gt;This is what it looks like now, but indicates 'unable to execute Arcade script"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnnettePoole1_0-1645227522234.png" style="width: 398px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34450iA6AD447737B3C26C/image-dimensions/398x549?v=v2" width="398" height="549" role="button" title="AnnettePoole1_0-1645227522234.png" alt="AnnettePoole1_0-1645227522234.png" /&gt;&lt;/span&gt;&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 23:39:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145902#M13592</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-18T23:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145905#M13593</link>
      <description>&lt;P&gt;You're &lt;EM&gt;so close! &lt;/EM&gt;Just a minor tweak and you'll have it.&lt;/P&gt;&lt;P&gt;In the &lt;STRONG&gt;return&lt;/STRONG&gt;, you only need to set the attribute "total" to the variable "total". In other words:&lt;/P&gt;&lt;PRE&gt;return {&lt;BR /&gt;    attributes: {&lt;BR /&gt;        total: total&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;And then put "{expression/total}" in the &lt;STRONG&gt;line item template&lt;/STRONG&gt; down below the code section.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 23:43:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1145905#M13593</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T23:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1146566#M13595</link>
      <description>&lt;P&gt;Thank you so so much. It worked!!! But now I have another issue.&amp;nbsp; In the dashboard I am using the list element and I want to sort the complaint count from high to low, but since the expression doesn't create a field I can't use the function that is in the element.&amp;nbsp; After research I found I could use an order by on the FeatureSetByName, however, in the dashboard that isn't an option to use the FeatureSetByName. I see there is a Sort in the dashboard -&amp;nbsp;&lt;SPAN&gt;Sort&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;inputArray&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;, comparator )&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;returns&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;{ Array }.&amp;nbsp; Would it accept expression/total?&amp;nbsp; Thinking out loud, I want it to sort my expression and return any greater than 5, but I am not sure how to make this work in Arcade.&amp;nbsp; Help again would be appreciated. Also what does this mean {Array}. Here is my stab at it. Thank you.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Sort (expression/total, &amp;gt; 5 ) returns { Array }&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 17:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1146566#M13595</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-22T17:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1146590#M13596</link>
      <description>&lt;P&gt;Ah, well now we've crossed into the realm of &lt;STRONG&gt;Data Expressions&lt;/STRONG&gt;, which are a different sort of animal. It can be a bit to wrap your head around when you're new to them, but I'm sure they'll quickly make more sense. You can see some examples here: &lt;A href="https://github.com/Esri/arcade-expressions/tree/master/dashboard_data" target="_blank"&gt;https://github.com/Esri/arcade-expressions/tree/master/dashboard_data&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal('your portal url')

var fs = FeatureSetByPortalItem(
    portal,
    'item id of service',
    0, // or other layer index, if multiple layers
    ['*'],
    false
)

// create output array of features
var feats = []

// iterate over featureset
for (var f in fs){

    // calculate sum
    var sum_fields = [
        f['some_field'],
        f['another_field'],
        etc
    ]

    var total = 0

    for (var s in sum_fields){
        If (!IsEmpty(sum_fields[s])){
            total += 1
        }
    }

    // create feature object
    var feat = {
        'attributes': {
            'total': total
        }
    }

    // add feat to feats array
    Push(feats, feat)
}

// Create FeatureSet JSON from feats array
var out_dict = {
    fields: [
        {name:'total', alias:'Number of Complaints', type:'esriFieldTypeInteger'}
    ],
    geometryType: '',
    features: feats
}

// Convert JSON to true featureset and return
return FeatureSet(Text(out_dict))&lt;/LI-CODE&gt;&lt;P&gt;To add a Data Expression to your dashboard, you can find the "add new data expression" button when you're adding a new widget or configuring the data source of an existing widget.&lt;/P&gt;&lt;P&gt;Once you get this written up and working, the resulting layer in your dashboard will behave as if the "total" attribute were a legitimate field in the table, allowing you to sort and filter to your heart's content.&lt;/P&gt;&lt;P&gt;Taking this a step further, supposing you wanted this list to interact with other widgets, you may need to include something like the objectID in the &lt;STRONG&gt;feat&lt;/STRONG&gt; attributes dict, as well as in the &lt;STRONG&gt;out_dict&lt;/STRONG&gt; fields list.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 17:42:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1146590#M13596</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-22T17:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1147649#M13597</link>
      <description>&lt;P&gt;Thank you for all your help. I am going to check into the above but first I have to figure out the IFF function. I appreciate all your help.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 18:27:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1147649#M13597</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-02-24T18:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate  Function Won't Update with New Values</title>
      <link>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1230539#M13705</link>
      <description>&lt;P&gt;Hello jcarlson,&lt;/P&gt;&lt;P&gt;Thanks to you I am working on this data expression.&amp;nbsp; I literally have included your script from above, but I am getting an error 'unexpected end of input'.&amp;nbsp; I have tried various things but nothing works. Do you see what I am doing wrong? This expression is where I am doing&amp;nbsp; a total count of complaints for a homeless camp, now I want to create it as its own attribute. I am in the dashboard and I selected serial chart, new data expression.&lt;/P&gt;&lt;P&gt;var portal = Portal("https://##############/portal")&lt;BR /&gt;var fs = FeatureSetByPortalItem(&lt;BR /&gt;portal,&lt;BR /&gt;'058330e0c9204c53b208400dd4b126c6',&lt;BR /&gt;0,&lt;BR /&gt;['*'],&lt;BR /&gt;false&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;var feats=[]&lt;BR /&gt;for (var f in fs){&lt;/P&gt;&lt;P&gt;var sum_fields = [&lt;BR /&gt;$feature.complaint,&lt;BR /&gt;$feature.contactinfo,&lt;BR /&gt;$feature.complaint2,&lt;BR /&gt;$feature.complaint3,&lt;BR /&gt;$feature.complaint4,&lt;BR /&gt;$feature.complaint5,&lt;BR /&gt;$feature.complaint6,&lt;BR /&gt;$feature.complaint7,&lt;BR /&gt;$feature.complaint8,&lt;BR /&gt;$feature.complaint9,&lt;BR /&gt;$feature.complaint82,&lt;BR /&gt;$feature.complaint11,&lt;BR /&gt;$feature.complaint12,&lt;BR /&gt;$feature.complaint13,&lt;BR /&gt;$feature.complaint14,&lt;BR /&gt;$feature.complaint15&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;var total = 0&lt;/P&gt;&lt;P&gt;for (var s in sum_fields){&lt;BR /&gt;If (!IsEmpty(sum_fields[s])){&lt;BR /&gt;total += 1&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var feat = {&lt;BR /&gt;'attributes': {&lt;BR /&gt;'total': total&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Push(feats, feat)&lt;/P&gt;&lt;P&gt;var out_dict = {&lt;BR /&gt;fields: [&lt;BR /&gt;{name:'total', alias: 'Number of Complaints', type: 'esriFieldTypeInteger'}&lt;BR /&gt;],&lt;BR /&gt;geometryType: '',&lt;BR /&gt;features: feats&lt;BR /&gt;}&lt;BR /&gt;return FeatureSet(Text(out_dict))&lt;/P&gt;&lt;P&gt;_______________________________________&lt;/P&gt;&lt;P&gt;Thank you very much. Annette&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 17:44:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-collector-questions/calculate-function-won-t-update-with-new-values/m-p/1230539#M13705</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-11-10T17:44:54Z</dc:date>
    </item>
  </channel>
</rss>

