To use Cognos product documentation, you must enable JavaScript in your browser.

Sort Data

By default, Report Studio retrieves items in the order defined in the data source. You can sort items to quickly view the most important data. Report Studio provides different sorting options depending on whether you use relational or dimensional data and depending on what type of data item you select.

Layout Sorting

If you use relational data, you can sort items in a list in ascending or descending order based on a value or a caption, such as revenue or employee name. You can also perform advanced sorting to sort columns within groups or to sort a row or column using another data item.

This type of sorting is performed in the report layout and not in the query. Sorting in the layout is useful when working with lists, when your report includes relational data, and when working with expression-based data items.

Set Sorting

If you use dimensional data, you can sort a set of members based on a caption (heading label). You can also perform advanced sorting to sort sets using an intersection (tuple) or using a member property. By default, when you select Sort Set - Ascending or Sort Set - Descending, sets are sorted based on captions.

For example, a set contains regions and you sort the regions within the set in descending alphabetical order. Only extended data items that represent sets support set sorting.

This type of sorting is performed in the query.

Before you can perform set sorting, you must create sets for the members in your report .

You cannot sort data items from different dimensions that are intermixed. For example, you cannot sort on Data_Item1_Dimension1, Data_Item1_Dimension2, Data_Item2_Dimension1.

You cannot apply set sorting and layout sorting at the same time. Sorting applied to an item will overwrite any previous sorting that was applied.

Sorting by Value

If you use dimensional data, you can sort members in the sets on the opposite axis based on the value of a member or measure that you select.

For example, a crosstab contains years inserted as individual members in the columns, product lines inserted as a member set in the rows, and revenue as the measure. You select 2004 and click the sort by value button and select to sort in descending order. The values in the 2004 column are sorted.

This type of sorting is performed in the query.

Before you can perform this sorting, you must create sets for the members in your report .

In nested crosstabs, items are sorted based on the values of the innermost nested row or column of the opposite axis. For example, a crosstab contains years in the columns and retailers nested within product line in the rows. Select 2004, sort in descending order, and you see retailers listed from the largest value to the smallest value for each product line.

Considerations When Sorting SAP BW Data

If you use a SAP BW data source, each level in a hierarchy has an item with the same name as the level, and has a role of _businessKey. Such items are known as level identifiers. You should use only the level identifier of all the time-related characteristics, such as 0CALDAY and 0CALMONTH, for sorting. All other (attribute) items in these hierarchies are formatted string representations of the characteristic values with which they are associated. These formatted values sort alphanumerically and not chronologically.

Tip: By level identifier, we are referring to a query item with the same name as the level that has the role of _businessKey. Each level in a SAP BW hierarchy has a level identifier.

Steps to Sort in the Layout
  1. Click the data item on which you want to sort.

  2. From the Data menu , click Sort Ascending or Sort Descending.

    Tip: If you are sorting an extended data item, click Layout first.

    An up arrow or down arrow appears beside the data item to indicate that a sort order was set.

    When you specify a sort order for more than one column, the columns are sorted in the order that they were inserted in the report. For example, you add columns A, B, and C to a report and specify a sort order for each. When you run the report, column A is sorted first, followed by B and then C. You can change the order in which the columns are sorted.

    Tip: To remove a sort order, click Don’t Sort.

Steps to Sort Sets by Caption
  1. In a crosstab, select a set to sort.

  2. Click the sort button  on the toolbar and click Sort Set - Ascending or Sort Set - Descending.

    Tip: To remove a sort order, click Don’t Sort.

Steps to Sort Sets in the Opposite Axis by Value
  1. In a crosstab, a member or measure to sort.

    For example, to sort a set in the row axis, select a member or measure in the column axis.

  2. Click the sort opposite axis sets by value button  on the toolbar.

    Tip: To remove a sort order, click Don’t Sort.

Perform Advanced Sorting

You can perform advanced sorting in a report. If you use relational data, in a list, you can sort columns within groups and change the sort order of columns. In a crosstab, you can sort a row or column by another item, such as Order year by Revenue.

If you use dimensional data, you can sort using the property of a member. For example, your report includes employee names and you want to sort the employees using the gender property. You can also sort using an intersection of members, also know as a tuple. For example, you want to sort the employees using the value of sick days taken for the year 2006 .

Steps to Sort in the Layout
  1. Click a column.

    In a crosstab, click the row or column for which you want to perform advanced sorting.

  2. From the Data menu, click Sort, Advanced Sorting.

  3. If you are sorting a list and you want to sort a column within a group, do the following:

  4. If you are sorting a list and you want to change the sort order of columns, in the Groups pane, change the order of columns in the Sort List folder of a group, or in the Detail Sort List folder.

    Tip: Add items to the Detail Sort List folder to sort items that are not groups.

  5. If you are sorting a crosstab, do the following:

Steps to Sort Sets
  1. Select a set, member, or measure to sort.

  2. Click the sorting button  on the toolbar and click Advanced Set Sorting or Layout, Advanced Sorting.

  3. Specify the sorting options that you want.

  4. If you are sorting members from different levels and want to preserve the hierarchy, select the Hierarchized sorting check box.

  5. If you want to sort items using a member property, under Sort by, click Property and click the ellipsis (...) button. Then, navigate the tree and select the member property you want to use.

  6. If you want to sort items using an intersection of members, or tuple, under Sort by, click Intersection (tuple) and click the ellipsis (...) button. Then, from Available members and measures, select the items you want to use and click the right arrow to move them to the Intersection members and measures list.