Is it possible to properly sort the categories axis in a Cognos line chart?
Using IBM Cognos Analytics 11.2.4.1IF1, I have tried using the line chart from each of the four visualization libraries. I'm having trouble getting the sorting correct.
My need is for cumulative values by month (human-readable month labels - mmm yyyy - on the X-axis), grouped (color/series), listed in date order with the values accumulating in month order.
As a starting point, I have created an example report spec using the GO Sales (query) package showing the line chart using all four visualization libraries, with year-month values (yyyymm) on the X-axis rather than the friendly values I want. Query1 gets my data, then Query2 (downstream of Query1) is used for the charts. It is needed so I could include running-total() without confusing Cognos.
So, starting with the report spec I provided...
(Working in Page preview to see immediate results.)
- In the 11.1 Visualizations chart
- Cut [YearMo] from the x-axis.
- From Insertable Object | Data Items, drag [Query2].[Mon Year] onto x-axis.
- Notice that the categories are sorted alphabetically -- Apr 2010, Apr 2012, Aug 2010, Aug 2012, etc.
- Select [Mon Year] in the x-axis slot and click on the Sort tool.
- Notice that the options are Ascending, Descending, and Don't sort
- fail
- Notice that the options are Ascending, Descending, and Don't sort
- In the 11.0 Visualizations chart
- Cut [YearMo] from the x-axis.
- From Insertable Object | Data Items, drag [Query2].[Mon Year] onto x-axis.
- Notice that the categories are sorted alphabetically -- Apr 2010, Apr 2012, Aug 2010, Aug 2012, etc.
- Select [Mon Year] in the x-axis slot and click on Sort | Edit layout sorting
- Drag [YearMo] to the Sort list and click OK.
- Notice that while the months labels are now sorted in the correct order, the cumulative values are still computed by month names, alphabetically. (Apr 2010 is the smallest value, followed by Apr 2012, etc.)
- fail
- Notice that while the months labels are now sorted in the correct order, the cumulative values are still computed by month names, alphabetically. (Apr 2010 is the smallest value, followed by Apr 2012, etc.)
The Legacy Visualizations chart and Charts chart behave the same as the 11.0 Visualizations chart.
I have also tried setting the Pre-sort property to Sort ascending for [YearMo].
What have I done wrong here? How can I make Cognos sort the labels and values correctly?
It seems completely bonkers that a high-end reporting product like Cognos can't do basic charting stuff. And I'm pretty sure this all worked properly in Cognos 10. I honestly hope I missed something. If you are a Cognos report development expert and also can't solve this problem, I would love to see that in the comments.
Regarding the source code:
I tried including my report spec here, but SO says "Body is limited to 30000 characters; you entered 40879." So I went to pastebin instead.
For the 11.0 visualization, please have a look if setting the Sorting on the Data property gets you what you are looking for.