COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Report Studio => Topic started by: opeshow on 22 Dec 2006 06:28:47 PM

Title: Previous Week
Post by: opeshow on 22 Dec 2006 06:28:47 PM
I am new to Report Studio.

Tyring to get information for the previous week of the calendar year.  I tried filtering with the following ...

_week_of_year(date_entered) = _week_of_year(getdate())

Whenever I try this I get an error around the '+', the first half without the comparison works fine but as soon as I try to constrain it I get errors.  Anyone know why this doesn't work?  Is there something I am doing wrong or perhaps there is a better way to determine if something was entered in the last calendar week.
Title: Re: Previous Week
Post by: coledog on 06 Jan 2007 11:36:22 AM
I dont know if this will help you and it's not the same thing you are asking for. I used this to get the same wtd last year in my report. I am using mssql 2000 database remember this is week to date

([ImportView].[TransDaily_Reporting].[Tr_Date]>= _add_days(_add_years(?Date?,-1),(_day_of_week(_add_years(?Date?,-1),7)-1)* -1)  and [ImportView].[TransDaily_Reporting].[Tr_Date]<= _add_years(_add_days(?Date?,1),-1))

I had to offset a day for prior year and the week run from sunday to saturday there is a problem with leap year
Title: Re: Previous Week
Post by: sir_jeroen on 06 Jan 2007 06:52:41 PM
Why don't you add a time dimension (Table with year,quarter, month,date, flag) with flags set to current week, previous week etc.... (1=current week, 2= prev week etc..)
Most easiest solution. Even with leap years.
Title: Re: Previous Week
Post by: coledog on 08 Jan 2007 02:14:18 PM
I like you answer to this problem. I have a question of you how do you handle the join in FM The time dimension table  is joined to what and how is it joined