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

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Concatenate dates side by side

Started by omega1983, 09 Jun 2016 06:46:19 PM

Previous topic - Next topic

omega1983

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??

Nagendar

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

BigChris

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...