COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Topic started by: satyagorantla on 04 Jan 2006 04:07:35 PM

Title: [Solved] Week ending Sunday date
Post by: satyagorantla on 04 Jan 2006 04:07:35 PM
Using the available date functions in report studio,How do I get the week ending sunday date of a particular date . For example, for 2006-01-04,week ending sunday date would be 2006-01-07.Any suggestions?

Thanks!
Title: Re: Week ending Sunday date
Post by: bdybldr on 04 Jan 2006 06:01:17 PM
Saty,
Create the following data item in your query:

CASE _day_of_week([Date], 7)

Ã,  WHEN (1) THEN (_add_days([Date], 6))
Ã,  WHEN (2) THEN (_add_days([Date], 5))
Ã,  WHEN (3) THEN (_add_days([Date], 4))
Ã,  WHEN (4) THEN (_add_days([Date], 3))
Ã,  WHEN (5) THEN (_add_days([Date], 2))
Ã,  WHEN (6) THEN (_add_days([Date], 1))
Ã,  WHEN (7) THEN ([Date])
Ã,  ELSE ([Date])Ã,  --- Or whatever you want as default.
END

Hope this helps.Ã,  Keep us posted.
Title: Re: Week ending Sunday date
Post by: satyagorantla on 04 Jan 2006 06:45:53 PM
That worked.Thanks very much!
Title: Re: Week ending Sunday date
Post by: bdybldr on 04 Jan 2006 06:59:40 PM
I'm glad it worked.  Thanks for the update.  Please close the thread (see board rules).  Thanks.