COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: omega1983 on 09 Jun 2016 06:46:19 PM

Title: Concatenate dates side by side
Post by: omega1983 on 09 Jun 2016 06:46:19 PM
cast([Expiration_Date],date)varchar(20))+' '+cast([Expiration_Date],date)varchar(20))   is what I want to use to capture the min and max based on week 1.   Here is an example of desired results
Expiration_Date       Week
2016-06-06               1
2016-06-09               1
2016-06-13               2
2016-06-17               2

I want this
2016-06-06 - 2016-06-09
2016-06-13 - 2016-06-17

The issue is since data is read row by row using min(Expiration_Date) and max(Expiration_Date) will only yield the max date.  Is there a way to produce the concatenated results desired here??
Title: Re: Concatenate dates side by side
Post by: Nagendar on 10 Jun 2016 01:14:13 AM
Quote from: omega1983 on 09 Jun 2016 06:46:19 PM
cast([Expiration_Date],date)varchar(20))+' '+cast([Expiration_Date],date)varchar(20))   is what I want to use to capture the min and max based on week 1.   Here is an example of desired results
Expiration_Date       Week
2016-06-06               1
2016-06-09               1
2016-06-13               2
2016-06-17               2

I want this
2016-06-06 - 2016-06-09
2016-06-13 - 2016-06-17

The issue is since data is read row by row using min(Expiration_Date) and max(Expiration_Date) will only yield the max date.  Is there a way to produce the concatenated results desired here??

Create two data items in quey like    minimum ([Expiration_Date] for [Week]) and maximum ([Expiration_Date] for [Week])
and try to follow this link
http://www.cognoise.com/index.php?topic=18532.0

I hope this will help you.

Thanks
Nagendar
Title: Re: Concatenate dates side by side
Post by: BigChris on 10 Jun 2016 02:22:17 AM
Or alternatively, create a table in your database with all of your dates, and corresponding fields for start and end dates. A calendar table will come in more handy than you would imagine...