Hello,
I hope someone can help since I am struggling with Date filter in an Arcade expression.
It is about Covid incidence and I need this for my work.
I would like to have an Indicator that shows me if the Incidence of the most recent record (DayZero) has increase or decreas, compared to the day prior of the most recent record (DayOne). I don´t use today and yesterday becasue the incidence is not always daily acutlized.
I am also not sure when I am suppossed to use '' or "" to reference fields (feature field and arcade dictionaries fields) in my expressions.
Let´s suppose my table looks like this:
ObjID | reportdate | incidence |
56 | 03.03.2022 | 1152,4 |
55 | 01.03.2022 | 1428,66 |
54 | 28.02.2022 | 1527,78 |
53 | 27.02.2022 | 1513,9 |
I tried the method shown here(Introducing Data Expressions in ArcGIS Dashboards (esri.com)) but it doesnt work. Any ideas pleas? 🙂
I thank you so much in advance!


Code is here:
var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),
'xxx' , 0, ['incidence','reportdate'], false)
// Filter the dataset to only have the most recent date.
var day_zero = Date(Max(fs,"reportdate"))
var day_zero_filter = Filter(fs, "reportdate = @day_zero")
// Filter the dataset to only have the day before the most recent date
var day_one = DateAdd(Date(Max(fs, 'reportdate')), -1, 'days')
var day_one_filter = Filter(fs, 'reportdate < @day_zero')
// Dictionary to hold ratio rounded with 2 decimals.
var ratioDict = {
'fields':
[{ 'name': 'ratio',
'type': 'esriFieldTypeDouble'
}],
'geometryType': '',
'features':
[{'attributes':
{'ratio': Round((Max(day_zero_filter ,'incidence') - Max(day_one_filter,'incidence')/Max(day_zero_filter ,'incidence'))*100,2),
}}]};
// Return dictionary as a featureSet.
return FeatureSet(Text(ratioDict));