Date Filters - Last Week

848
3
01-26-2022 08:32 AM
JonathanMcDougall
Occasional Contributor III

I've report experience that I want to show/report data within the last week. Data for the report is run only on a Friday, covering Friday 5pm to following Friday at same time (inc weekends) and I don't want to lose the visibility of information as "7 days" pass, same for "1 week".

Is there an easy way, just to filter for "Date Last Week"?

0 Kudos
3 Replies
rzufelt
Occasional Contributor

Have you tried the expression builder in the filter widget?

It has a last week option:

rzufelt_1-1643225730011.png

 

R_

0 Kudos
JonathanMcDougall
Occasional Contributor III

Hi, thanks for the reply.

I should have perhaps been more specific - the last 1 week counts back 7 days from today and I'm also looking to have this filter used to create dynamic text.

eg; Number of objects created last week; 999 (filter being "Date is Last Week", a change of xxx.

So, last week one or even last 7 days moves forward with every new calendar day. A "is Last Week" option would "cement" the return to a set period.

0 Kudos
RhettZufelt
MVP Frequent Contributor

One option would be to put an Arcade expression on the symbology in the web map and only have it draw the features with date of "Last Week".

Not sure how you would do the math to find the difference, but can easily make the map display only them.

 

 

var draw = Null;

if (Year($feature.CreationDate) == Year(Now()) && Week($feature.CreationDate) == (Week(Now())-1)){
draw = "Yes";
}
return draw

 

 

 

Quick test with the above Arcade (and turn off "other values" in symbology tab) will only draw data from last week.

Selects by week number, so put the year comparison in there so it doesn't grab everything from that "week" regardless of year.

Would have to modify it a little to handle the first week of the year (Week = 0) as some of it might get filtered out due to the year.

 

R_

 

0 Kudos