COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: satyabadi on 30 Sep 2012 01:40:36 PM

Title: Date conversion
Post by: satyabadi on 30 Sep 2012 01:40:36 PM
Hi All,

I have a quarter field in data base like 200401 ,200402 like this for 1st quarter & 2nd quarter respectvely .
But I want to show it like "first quarter", "second  quarter" instead of 200401,200402 .
(for data ref:you can check go sales package)

How can i do this ?

Thanks in adv!!
Title: Re: Date conversion
Post by: Momin on 01 Oct 2012 12:04:40 AM
Hi,

U want show "first quarter", "second  quarter" instead of 200401,200402 .If these are the only values u are getting from database.Then u can create one data item by using case function.

case if(quarter field=200401) then  "first quarter" else "second  quarter" end.

if u are getting more than two value from dta base for quarter field then u have to edit the case function as folows.

case if(quarter field=200401) then  "first quarter", if(quarter field=200402) then  "second  quarter"   if(quarter field=200403) then  "third  quarter" end.

Regards,
Momin.
Title: Re: Date conversion
Post by: HalfBloodPrince on 01 Oct 2012 12:29:26 AM
Try this

if (substring( cast ([date], varchar(10)),5,6)='01') then
('Quarter 1')
else
if(substring(cast([date], varchar(10)),5,6)='02') then
('Quarter 2')
else
if(substring(cast([date], varchar(10)),5,6)='03') then
('Quarter 3')
else

('Quarter 4')