COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: oscarca on 21 Sep 2018 02:49:38 AM

Title: Date format conversion
Post by: oscarca on 21 Sep 2018 02:49:38 AM
Hey Cognos people,

Is it possible to convert integer 20180501 to this format 2018/May and if so how ?

What I have done so far is:
Created 4 data items
[Date]:cast([Verksamhet].[Order Stock].[Faktiskt Leveransdatum];date)

[Month] : case
extract(month;[date])
when 1 then 'January'
when 2 then 'February'
when 3 then 'March'
when 4 then 'April'
when 5 then 'May'
when 6 then 'June'
when 7 then 'July'
when 8 then 'August'
when 9 then 'September'
when 10 then 'October'
when 11 then 'November'
when 12 then 'December'
else 'error'
end

[Year]: extract(year;[date])

[Year/Month]: [Year] || '/' || [Month]

But then getting error:
The operation "add" is invalid for the following combination of data types: "integer" and "character"


Many thanks,
//Oscar
Title: Re: Date format conversion
Post by: oscarca on 21 Sep 2018 05:14:51 AM
This was actually easier than I thought.. Manage to do it just by setting date pattern to yyyy/MMM after I had converted the int to date which gives me 2017/may