I'm trying to add a new variable to my data set that is the difference between two dates, End and Start Date. I plan on using it in an indicator to show average time to close a WO. I created a new Arcade expression, but am receiving an error with it. Maybe there is a between way to achieve this than using an Arcade Expression. I was able to add this data to the pop-ups, but am having trouble recreating within the dashboard.
var fs = FeatureSetByPortalItem(
portal,
'9437842bc29b54b07993a9b6b3d63c0d1"',
0,
[
'InitiateDate',
'DateWoClosed'
],
false
);
var startDate = 'InitiateDate'
var endDate = 'DateWoClosed'
var calcDate = DateDiff(EndDate, start_Date, 'hours')
var DiffDate = {
'fields': [{'name':'calc_date', 'type':'esriFieldTypeDouble'},
{'name':'start_date', 'type':'esriFieldTypeDate'}
{'name':'end_date', 'type':'esriFieldTypeDate'}],
'geometryType': '',
'features':
[{'attributes':
{'start_date': startDate,
'end_date': endDate,
'calc_Date': calcDate
}}]};
return FeatureSet(DiffDate);