O'Reilly logo

MDX with Microsoft SQL Server 2016 Analysis Services Cookbook - Third Edition by Sherry Li, Tomislav Piasevoli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required