Select to view content in your preferred language

Dynamic Date Filter to Show Current Year Only

332
4
05-22-2025 10:17 AM
mwartman_grey
Regular Contributor

I'd like to setup a filter in an AGOL web map to only display features with a date attribute in the current calendar year. I.e., show all features in the current calendar year '2025', but when the year changes the map will automatically update to only show features with dates in '2026' and so on. 

One option is to set the filter to be after January 1 of the current year, but this requires a manual intervention to update the date at the start of each year: 

mwartman_grey_0-1747933520100.png

 

There is also 'in the last' filter, but this includes all dates in the past year, not by the calendar year. 

mwartman_grey_1-1747933566573.png

 

I found this resource but this doesn't work with symbology with unique values, and it only hides features (the pop-ups still appear).

Feeling stuck here. Is there any way to set up a filter like this directly in a web map? 

Tags (4)
0 Kudos
4 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @mwartman_grey,

One way you can set the filter to start by calendar year is to do the following:

  1. Set the filter condition to <date field> IS YEAR TO DATE or <date field> IS THIS YEAR
0 Kudos
mwartman_grey
Regular Contributor

@RPGIS, not sure where to see those options in the map viewer filter builder. These are the date condition options I see:

mwartman_grey_0-1747938270635.png

 

0 Kudos
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Sorry @mwartman_grey ,

I realized that I was thinking of the filter that is used in the Dashboards. In terms of filtering by the current year, the best way is to usually create another field as text ( ex. "Current" ) if the year is equal to this year and filter by that value. There are python scripts that you can run to populate the field. You can go a step further by automating the script using .bat file and run using windows task scheduler.

0 Kudos
mwartman_grey
Regular Contributor
0 Kudos