COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: t0mato on 09 Sep 2021 03:20:10 PM

Title: Filter Report Date for Previous Week
Post by: t0mato 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!
Title: Re: Filter Report Date for Previous Week
Post by: t0mato on 09 Sep 2021 04:04:03 PM
Quote from: t0mato 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!

I've found a solution!

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