COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: blaubner on 18 Sep 2017 04:05:07 PM

Title: Transpose Query Data
Post by: blaubner on 18 Sep 2017 04:05:07 PM
Imagine you create a query (Get_Majors) that collects the ID and major(s) for three students. The query results are below:








IDMajor
01938MATH
01938PHYS
01938CSCI
32211HIST
29403PSYC

I want to transpose the data on MAJOR by ID. The end result would look like this:






IDMajor1Major2Major3
01938MATHPHYSCSCI
32211HIST
29403PSYC

Super easy in SAS. Hoping its super easy in report studio. I want to be able to build the query Get_Majors to look like the end result. I will be left joining other data onto Get_Majors once I get one row per student.

Thanks for your help. I apologize if this has already been asked elsewhere. I could not find an example thread when I searched.

Brendan
Title: Re: Transpose Query Data
Post by: bdbits on 19 Sep 2017 09:00:36 AM
You've not said whether your data source is relational or dimensional, but this looks like a basic crosstab to me.

Have you perused the Report Studio user guide (same as help)? It is actually pretty good as a tutorial / introduction on Cognos essentials.
Title: Re: Transpose Query Data
Post by: blaubner on 19 Sep 2017 10:51:40 AM
ID and Major sit in a table, so that would mean it's relational data right?

Are you suggesting I build a cross tab on a report page? How would I get the report page into my list of queries under Query Explorer so I could left join more data onto the cross tab?

Brendan
Title: Re: Transpose Query Data
Post by: New_Guy on 21 Sep 2017 09:56:57 AM
Hi,
How are you determining which major is major 1 or 2 or 3? If you have to show it in the way you want to then use a list and add 1st column as ID and second column a crosstab and place the major code in the column and format the crosstab to hide rows and fact cells and the corner.
Good luck
New guy