COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Active Reports => Topic started by: ddma on 02 Feb 2021 07:18:53 AM

Title: sort bar chart based on total value
Post by: ddma on 02 Feb 2021 07:18:53 AM
Hi.

I would like to create stacked bar chart in Cognos 11 Active report and sort it but looks like Im missing something.

I have dataset that consists of 3 columns:
1. Class
2. Boy / Girl
3. Name Surname

Based on it I want to create stacked bar chart, that should show:
on X: total number of persons
on Y: Class

additionaly: Class should be splitted by Boy/Girl AND sorted by total number of persons

Example:

ClassA -----=======

ClassC --=======

ClassB ----
          0     10    20

where - is boys and colored in red
where = is girls and colored in green

I am able to create such chart, but when I sort, it sorts in very weird way (probably by boys value, but not by total boys+girls value).

Below what I do:
1. Chreate stacked bar chart
2.Properties:
Default Measure X-axis: Name Surname
Series (Primary Axis): Boy/Girl
Categories (Y-Axis): Class

Then I go to Query and choose Name Surname - Detail Agregation: Count. Then choose Sort Name Surname ascending. Then go to Series (Primary Axis) Palette and change colors I would like to have.

Could you pls advise what Im doing wrong? Am I missing something? Thanks
Title: Re: sort bar chart based on total value
Post by: dougp on 02 Feb 2021 11:50:53 AM
Try adding a data item to the query...
total([Name Surname] for Class)
...and using it to sort.