COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: lifzgud on 03 Sep 2009 05:14:18 AM

Title: Need to display past week data
Post by: lifzgud on 03 Sep 2009 05:14:18 AM
For eg.
If i run the report on Monday or any other weekday , it should show me the data from last weeks saturday to the present week's sunday

eg. If i run the report on 14th sept 2009 it should show me data from 6th to 12th sept.There is a date column present in my report that i am using in the filter
Any idea on how to go abt this?
Title: Re: Need to display past week data
Post by: sridharansathya on 03 Sep 2009 06:23:12 AM
case when to_char(sysdate,'Day') in ('Monday' )
then date between add_days(to_char(date),'-8') and add_days(to_char(date),'-1')
to_char(sysdate,'Day') in ('Tuesday' )
then date between add_days(to_char(date),'-9') and add_days(to_char(date),'-2')
similarly till friday

I have just framed the logic , not tried with it........
Please check this logic whether it suits or not and let me know.........

Sathya.