Author Topic: Filter Report Date for Previous Week  (Read 261 times)

Offline t0mato

  • Full Member
  • ***
  • Join Date: Aug 2020
  • Posts: 48
  • Forum Citizenship: +0/-0
Filter Report Date for Previous Week
« on: 09 Sep 2021 03:20:10 pm »
Hi,

I'm working on a scheduled weekly report. It is to be distributed each Monday for the previous week's data (Mon - Sunday). I.e. if i'm sending the report on Monday, 9/13, the date range would need to be for Mon 9/6 through Sunday 9/12.

If [Date] is my data item to filter, how would one write this query? I have a general idea using _add_days and _day_of_week and current_date but am unsure exactly how to piece them together to achieve this.

Thanks!

Offline t0mato

  • Full Member
  • ***
  • Join Date: Aug 2020
  • Posts: 48
  • Forum Citizenship: +0/-0
Re: Filter Report Date for Previous Week
« Reply #1 on: 09 Sep 2021 04:04:03 pm »
Hi,

I'm working on a scheduled weekly report. It is to be distributed each Monday for the previous week's data (Mon - Sunday). I.e. if i'm sending the report on Monday, 9/13, the date range would need to be for Mon 9/6 through Sunday 9/12.

If [Date] is my data item to filter, how would one write this query? I have a general idea using _add_days and _day_of_week and current_date but am unsure exactly how to piece them together to achieve this.

Thanks!

I've found a solution!

[Date] between
_add_days (current_date,-7)
and
_add_days(current_date,-1)