COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: kennedto on 12 Feb 2016 09:26:44 AM

Title: Week OF as a Date
Post by: kennedto on 12 Feb 2016 09:26:44 AM
I am using Cognos 10.2 with DB2

I would like to get the beginning day of the week for a date.  I tried this, but it says:
This give:
[BusinessView].[DELTICKET].[Start Date]-dayofweek( [BusinessView].[DELTICKET].[Start Date]) days

gives this error:
V5 syntax error found for data item 'Week Of' of query 'Query1', invalid token "days" found after "[BusinessView].[DELTICKET].[Start Date]-dayofweek( [BusinessView].[DELTICKET].[Start Date]) ".

However, this
[BusinessView].[DELTICKET].[Start Date]-1 days

Runs without error.

Only difference is -dayofweek function for the desired date.
Any idea what I am doing wrong here.
Title: Re: Week OF as a Date
Post by: Lynn on 12 Feb 2016 10:09:35 AM
Try using the add days function:


_add_days ( [BusinessView].[DELTICKET].[Start Date], ( _day_of_week ( [BusinessView].[DELTICKET].[Start Date] * -1 ) )
Title: Re: Week OF as a Date
Post by: kennedto on 12 Feb 2016 11:00:40 AM
That did it.  Thanks.