COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: jd on 02 Feb 2009 11:29:47 AM

Title: how should I get current week number
Post by: jd on 02 Feb 2009 11:29:47 AM
how should I get current week number?

Ex: my fiscal year starts from July, this is my 31st week. when I am pulling week to report it is giving all weeks 1 to 53. I want to see only this week number =31. to get all fiscal weeks  I am using YTD filter.

Thanks in advance.
Title: Re: how should I get current week number
Post by: sgotike on 02 Feb 2009 12:15:02 PM
Can't you use the function  _week_of_year  ?
Title: Re: how should I get current week number
Post by: jd on 02 Feb 2009 12:26:13 PM
Hi,
I am not sure how to use it.
I have fiscal week  and fiscal week start date in my model.

Please could you explain me how to use week_of_year function.
when I use it can I see from 1 to 31 weeks data.

Thanks in advance.
Title: Re: how should I get current week number
Post by: blom0344 on 02 Feb 2009 12:37:15 PM
Fiscal years that run heavily out of synch with a calender year demand an appropriate date/calender table. This way you will not have to recompute over and over again. Once you have populated the calendertable you can reuse it (using shortcuts in the model) for fiscal calcs..
Title: Re: how should I get current week number
Post by: sgotike on 02 Feb 2009 12:37:43 PM
Is this in a package? Is it a query item?
Title: Re: how should I get current week number
Post by: jd on 02 Feb 2009 12:42:44 PM
Fiscal week is  a query item
Title: Re: how should I get current week number
Post by: sgotike on 02 Feb 2009 12:49:38 PM
I am not sure if I understand your question, but anyway let me try

Is this a date field like Jan 1, 2009?
You can edit the query item to a week number or you can create an extra query item based on the fiscal date.

For example if you want to convert the fiscal date to week number:
Double click the query subject, select the fiscal date query item, right click, select edit query item and add before the item  _week_of_year (, and add the ending ')'.

For example if your query item name is fiscal_date, and your query subject name is fiscal_dim and your source is fiscaldb, it would look like this:

_week_of_year([fiscaldb].[fiscal_dim].[fiscal_date])

this will convert the fiscal date to the week of the year.