Arcade Expression for Serial Chart

04-26-2022 12:45 PM
Labels (1)
New Contributor

I am trying to create an arcade expression to power a serial chart to show days of the week statistic of incidents in city. I used the weekday function to calculate days of the week which returns number from 0 to 6 and also extracted weekday as a string and then loop through the feature set and copy over the extracted values to a dictionary. The written code below has worked accordingly and the result is the table below. The problem is all the values are shifted. I think it's happening because the day of the week start with Sunday. How can I shift the values or change the start of the week from Sunday to Monday so that Monday there is 1400 accidents, Tuesday 1200, Wednesday, 1580 etc.??




var fs = FeatureSetByPortalItem(Portal(''),
['Dates', 'NumberofIncident'], false
var sql = "Dates BETWEEN '01/01/2020' AND '12/31/2020'"
var fs_filt = Filter(fs, sql)

var dowDict = {
'name': 'dow_num',
'type': 'esriFieldTypeInteger'
'name': 'dow',
'type': 'esriFieldTypeString'
'name': 'incidents',
'type': 'esriFieldTypeInteger'
'geometryType': '',
'features': []

var index = 0;

for (var feature in fs_filt) {
dowDict.features[index] = {
'collisions': feature["NumberofIncident"]

var fs_dict = FeatureSet(Text(dowDict))
return GroupBy(fs_dict, ['dow_num','dow'],
[{name: 'incidents_by_Date',
expression: 'incidents', statistic: 'COUNT' } ])
0 Kudos
1 Reply
Esri Esteemed Contributor

Hi @EfeUngun ,

A couple of thoughts on the subject.

There is a ISOWeekday function: 

  • Returns the day of the week of the given date, based on the ISO 8601 standard. Values range from 1-7 where Monday is 1 and Sunday is 7.


However, if you believe that statistics are shifted, it might be good to have a look at the data and especially the dates. Normally dates are stored in UTC time and when working with dates it will take into account your timezone to work with the dates correctly. If the data was loaded into a featureservice this might be something to validate. It is possible to use ToLocal or ToUTC functions to alter the date (or a personalized DateAdd function) before creating the statistics but it takes some validation to be sure that the outcome is correct.


0 Kudos