Sorting data by dimensions
There are usually two types of sorting requirements in reporting: one is to sort by numeric measures and the other is to sort by dimension members alphabetically.
Data from SSAS is naturally sorted by attributes in dimensions. Members in an attribute can be sorted by its own key or name value or sorted by another attribute's key or name value. The two properties that are related to member sorting are OrderBy
and OrderByAttribute
.
For example, if we put all members from the Date
attribute on the ROWS
axis, the results will already be sorted in ascending order of the date. This is because the Date
attribute is sorted by its key value in the cube.
[Date].[Date].[Date].MEMBERS
If we CROSSJOIN
multiple sets, as shown in the following code snippet, the result will be sorted in ascending date order, then by customer name, and then by subcategory. In this case, the position of the set matters. The sorting order will be from left to right in ascending order.
[Date].[Date...