If you are unable to create a new account, please email support@bspsoftware.com

 

How to modify the week in year start date for a date format pattern?

Started by ffeldhaus, 17 Feb 2016 09:56:46 AM

Previous topic - Next topic

ffeldhaus

In cognos I have a full date from SQL. When I create a data format with format type date and pattern ww/yy the first week starts already in the last days of the last year - e.g. the week starting on 27th december 2015 is dispayed as week 1 (or 01/15 for the ww/yy pattern). how can I modify the date format to start with the first week in the new year - e.g. 3rd January?

I need to use date formatting to get proper sorting by full date. Currently with the date pattern ww/yy the weeks are displayed (until the current date) as
52/15
01/15 <- wrong, should be 53/15
01/16
02/16
03/16
04/16
05/16
06/16
07/16
08/16 <- wrong, should be 07/16 for today

Is this configurable? What other options do I have?

Lynn

Quote from: ffeldhaus on 17 Feb 2016 09:56:46 AM
In cognos I have a full date from SQL. When I create a data format with format type date and pattern ww/yy the first week starts already in the last days of the last year - e.g. the week starting on 27th december 2015 is dispayed as week 1 (or 01/15 for the ww/yy pattern). how can I modify the date format to start with the first week in the new year - e.g. 3rd January?

I need to use date formatting to get proper sorting by full date. Currently with the date pattern ww/yy the weeks are displayed (until the current date) as
52/15
01/15 <- wrong, should be 53/15
01/16
02/16
03/16
04/16
05/16
06/16
07/16
08/16 <- wrong, should be 07/16 for today

Is this configurable? What other options do I have?

Looks like it is following the ISO standard for weeks of the year:

Quote
Week 1 of the year is the first week of the year to contain a Thursday, which is equivalent to the first week containing January 4th. A week starts on Monday (day 1) and ends on Sunday (day 7).

If you have a date dimension you could have the ETL work out whatever week number makes sense for reporting requirements.

How about putting year before week number and basing the sort on that instead? You could have it as a data item used purely as a sort key while still displaying the ww/yy format on your layout.