Select to view content in your preferred language

Create Dynamic Date Range Expression that shows Date Range of Displayed Data

754
2
04-06-2023 11:17 AM
WalidAlmasri1
Regular Contributor

Hello,

I've created a dashboard where the data displayed is on a rolling 30-day time frame.  The data updates once a day, with the previous days data being the most current.

Is it possible to create an expression that displays the date range of my data every day it is refreshed?  Similar to the example below?  Area in yellow would change based on the date range of my data.

WalidAlmasri1_0-1680805437287.png

My time field looks like this:

WalidAlmasri1_1-1680805011401.png

Thank you!

 

0 Kudos
2 Replies
Omar_A
by Esri Contributor
Esri Contributor

Hi Walid,

Try this an Arcade expression to generate the desired date range. 

var currentDate = Date()
var endDate = DateAdd(currentDate, -1, 'days')
var startDate = DateAdd(endDate, -29, 'days')

var startDateFormat = Text(startDate, "MMMM d, yyyy")
var endDateFormat = Text(endDate, "MMMM d, yyyy")

return startDateFormat + " - " + endDateFormat

 

0 Kudos
WalidAlmasri1
Regular Contributor

Thanks!  This definitely helps, but I am trying to add the date range of the data in the title of the dashboard.  Is that even possible?

0 Kudos