Generally there 2 types of sorting: Display sorting and calculation sorting. Display sorting is used to sort data in a template. This document discusses display sorting with the interaction between sorting and pivoting as the focus.
Calculation sorting applies to metric computations that depend on the order of values: Ranking, and OLAP windowing functions such RunningSum or MovingSum. Calculation sorting is not affected by the distribution of report objects into the row, column or page axes, and is not covered in this document.
1. Sorting in General
Sorting is an important function in crosstabbing, where sorting along each axis is independent of the others. Row, column and page-by axes can be sorted according to template units (attributes, metrics, consolidations and custom groups). Hierarchies, however, are first rendered into attributes in the template so sorting can be defined. Except for metrics, the sorting for each axis can only be defined by the template elements appearing on that axis. Sorting by metrics can be defined on row or column; the axis of a metric sort need not be the same as the axis containing the "Metrics" template unit.
Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. | Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. |
Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. | Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. |
Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. | Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. |
Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. | Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. |
Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. | Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. |
Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. | Sorting TypeDescriptionAttribute Form SortSort by attribute formAttribute Default SortUse the attribute default sort as the sorting key. KB16623: How does MicroStrategy resolve the default sort order for an attribute)?Metric SortSort by metric valueMetric Hierarchical SortA variant of metric sorting, where sorting is applied to subtotal levels.Subtotal Position in SortDetermines the position of subtotal(s) in sorting, thus metric sorting can be applied without mixing the subtotal rows. |
2. Pivoting
After the report is executed, the user might want to perform certain manipulations, such as pivoting. It is important to maintain a reasonable ordering of the headers after pivoting (including page-by). Considering the sort type, there are several rules that can be used to determine how sort definitions can be applied to template objects and, if necessary, moved to another axis to accommodate the pivot operation.
- Attribute Form Sort
Since this sort actually depends on an attribute, if that particular attribute is deleted from or added to a certain axis, a corresponding attribute form sort should be deleted or added as well. That way, the sorting information is kept with the attribute and adheres to the sorting style on whatever axis it was moved to (or deleted from the original axis.).
In fact, there is always a default attribute form sort which is unaffiliated with pivoting. Attribute Default sort applies to each attribute and is, by default, used if no other sort is specified.
- Metric Sort and Metric Hierarchical Sort
If the Metric sort is defined on the same axis as the metric being sorted, then the sort defined on other metrics may be moved to the target axis when the sorted metric is pivoted. Metric Hierarchical sorting is also affected by pivoting and moves with the metric unit.
However, if the Metric sort is on a different axis than the metric unit, then it will not be affected by the pivot. A metric sort could specify a list of chosen attribute elements in addition to the metric and subtotal tag. When an attribute is moved, the sort can still apply, provided that the sort still specifies an element for all the attributes on the axes other than the one to be sorted. If there is no such element specified, the subtotal element and be selected. (Please refer to an example in section 3.)
- Subtotal Position in Sort
Subtotal Position does not depend on any unit. User can define it in "Display Option" tag of subtotal editor for specific subtotal(s).
3. User Scenarios
- A simple example of Attribute Form sort
Use a report named Template as an example, which has 4 attributes: Category, Country, Region, and Year, an 2 metrics: Cost and Revenue. Total is also defined as the subtotal.