Create 12 columns for months by writing single case statement?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the model filter?

602


Hi All, Is there any way to check whether a value is selected in a Multi-select tree prompt? I have a tree prompt and want to get to know whetehr which values user has selected,i want to so that values on the top of the report. I Have used that paramDisplayValue('paramername'),But it will display only last selected value. For Example i have tree prompt with one level Region- >country->states If user select region Asia it will dislay the all the Countries in that region and then if user select India it will display the states related to india only Suppose Hierachy look like this: Asia->India->Andhra Pradesh. I want to show this hierachy on the top of the report How it is possible? Can you please help me?

1655


Can you define slice?

628


Can you define metrics designer?

610


How can we create a dynamic column name in cognos?

539






What are all the types of report?

575


How do you Parametermap variables in Quiries?

1779


what is the diff. between a link n a union? what is a custom view? what is the use of unlocking a report ? plz answer to these

1601


What are the different types of important services used in cognos?

589


What are all the components of Report Studio?

671


Can we create 2 conditions in report expression of a single data item..Eg: I added 2 new dataitems each one should show revenue for Q1 and Q2..Pls advice

2145


Can you define report item?

594


What is difference between informatica power mart and power center?

569


------------- How to identify the Revenue Column in Report?

1826


describe the starschema grouping ?how can i add a new column for existing report ,when it is not present even in model & dataabase?

1903