Create 12 columns for months by writing single case statement?



Create 12 columns for months by writing single case statement? ..

Answer / naresh

To create 12 columns for months by single case statement :-

Step-1: Create one derived column and name it as 'months'.

Step-2:In Derived Expression use the below case statement and click on ok -

case
when extract(month,DATE_Column)=1 then 'JAN'
when extract(month,DATE_Column)=2 then 'FEB'
when extract(month,DATE_Column)=3 then 'MAR'
when extract(month,DATE_Column)=4 then 'APR'
when extract(month,DATE_Column)=5 then 'MAY'
when extract(month,DATE_Column)=6 then 'JUN'
when extract(month,DATE_Column)=7 then 'JUL'
when extract(month,DATE_Column)=8 then 'AUG'
when extract(month,DATE_Column)=9 then 'SEP'
when extract(month,DATE_Column)=10 then 'OCT'
when extract(month,DATE_Column)=11 then 'NOV'
when extract(month,DATE_Column)=12 then 'DEC'

end

Step-3: Click on derived Column 'Months' and go to 'Structure' tab in File Menu and then click and 'Pivot list to Cross tab '

Step-4: Run and check the report.
Thats it ..

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Cognos Interview Questions

Why do we create shortcuts in framework manager

4 Answers  


What is Star schema group?

1 Answers   IBM,


when can i use the STAR Schema and SNOWFLAKE Scgena

4 Answers   IBM,


we have package it contain Query subject (123456). If u generate report with 6 query subject error will occure how to resolve this problem

1 Answers   IBM,


how many types of keys are there i.e primary key and foreign key etc..?

3 Answers   IBM,






Actually we have 500 users when they run the report display the flage image related country user? How its possible?

0 Answers  


How to create a dynamic column name in Cognos?

6 Answers   Aditya Birla, Polaris,


WHAT ARE THE TYPES OF LIST REPORTS?

4 Answers   Patni,


In my report i want display sales rep name, country ,city how to achieve this by using repeater table

0 Answers   IBM,


Can anyone tell me the step by step process how to connect cognos to oracle?

3 Answers  


what is field set? what is the query calculation and layout calculation?

2 Answers   Syntel,


What is the use of 'individual data source' option while using filter in query studio?

1 Answers   Thomson Reuters,


Categories