Change Sort Options on Dimension Attributes in SSAS

Problem

By default, SQL Server Analysis Services will sort and display dimension attribute values in alphabetical order. When displaying the days of the week or the months of the year (as shown below), we often want to see the data in chronological order instead of alphabetical order.  How can we solve this problem?

Changing Sort Options on Dimension Attributes in SQL Server Analysis Services

Solution

In this tip, we will demonstrate an easy way to change the displayed sort order for a dimension attribute.

As shown below, we have a simple cube built from the Fact Sales Quota measures table and the Date and Employee dimensions.

We will demonstrate an easy way to change the displayed sort order for a dimension attribute.

Display the Properties Window, open the Date dimension in Visual Studio and choose the column whose displayed sort order needs to be changed.

Open the Date dimension in Visual Studio

In the Properties Window, scroll down to the Source grouping and click on the ellipsis (…) to the right of the KeyColumns.

scroll down to the Source grouping and click on the ellipsis

Remove the EnglishMonthName column from the Key Columns box by pressing the “<” button.

Remove the EnglishMonthName column from the Key Columns box

Click on MonthNumberOfYear in the Available Columns box and move it to the KeyColumns by pressing the “>” button. Click on OK.

Click on MonthNumberOfYear in the Available Columns box

Click on the ellipsis to the right of the NameColumn.

Click on the ellipsis to the right of the NameColumn.

Click on EnglishMonthName and click on OK.

Click on EnglishMonthName and click on OK.

Click on the ellipsis to the right of the ValueColumn.

Click on the ellipsis to the right of the ValueColumn.

Click on MonthNumberOfYear and click on OK.

Click on MonthNumberOfYear and click on OK.

The changes are now complete.

The changes are now complete.

After deploying and processing the changes to the Analysis Services server, we can browse the cube and see the month names in chronological order.

Deploying and processing the changes to the Analysis Services server

Next Steps

Leave a Reply

Your email address will not be published. Required fields are marked *