Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sort by key in Excel connected to SSAS OLAP cube

Tags:

excel

olap

ssas

I searched the Internet and StackOverflow and was not able to find an answer to this issue. I created an OLAP cube via SSAS with a date dimension. One of the attributes of the dimension is Activity Calendar Month. The NameColumn value is formatted like "January 2015", "February 2015", etc.

The KeyColumns is set as a DATE value type for the first of the month, for each month. Example, NameColumn value "January 2015" = KeyColumns value "1/1/2015", "February 2015" = "2/1/2015", etc.

The ValueColumn is also set to first of the month date (i.e. '1/1/2015') in case Excel was using that for sorting.

When I view the Calendar Month dimension in an Excel 2013 workbook, it initially loads with the correct sorting. Below is a sample:

January 2015
February 2015
March 2015
April 2015
May 2015
June 2015
July 2015
August 2015
September 2015

However, I want to be able to right-click on the field in Excel and select Sort > Sort Z to A and sort the months descending. When I currently do this, I get back:

September 2015
May 2015
March 2015
June 2015
July 2015
January 2015
February 2015
August 2015
April 2015

To me, it appears the Excel will only sort based on the alphanumeric value set in the dimension's NameColumn. Also, if I drop the years from the month values (i.e. "January" instead of "January 2015"), Excel seems to understand that it is a month and sorts the months correctly.

Screen Shot of Dimension Settings

Activity Calendar Month properties

Questions

  • Does Excel have the capability to sort on values outside of NameColumn, such as KeyColumns or ValueColumn, where the NameColumn does not use standard month names (i.e. "January", "February", etc.)?

  • If yes, then what might I be missing in the SSAS dimension setup to make this work?

like image 326
Shayne Ephraim Avatar asked Sep 17 '15 20:09

Shayne Ephraim


People also ask

How do I add OLAP tools to Excel?

In Excel, you can connect to OLAP cubes (often called multidimensional cubes) and create interesting and compelling report pages with Power View. To connect to a multidimensional data source, from the ribbon select Data > Get External Data > From Other Sources > From Analysis Services.

What is OLAP data in Excel?

OLAP is a database technology that has been optimized for querying and reporting, instead of processing transactions. The source data for OLAP is Online Transactional Processing (OLTP) databases that are commonly stored in data warehouses.


1 Answers

Can you read the last paragraph here: https://olappivottableextend.codeplex.com/wikipage?title=Show%20Property%20as%20Caption&referringTitle=Home

One advantage of the built-in "Show Properties In Report" feature is that the member properties come through into Excel with their proper datatypes. So a member property of datetime datatype comes across as such and can be formatted using Excel formatting. And numeric member properties come across as such and can be formatted in Excel. However, when you use any member property as a caption using the "Show Property as Caption" OLAP PivotTable Extensions feature, the caption comes across as a string and cannot be formatted in Excel, unfortunately.

It talks about formatting in Excel but I believe sorting in Excel applies too.

So... Add a new member property of your Activity Calendar Month attribute with the same date key (first of the month) then add that member property to the PivotTable and try to sort by it. If you can, great. If not then install that OLAP PivotTable Extensions add-in and use Show Property As Caption then sort. Make sense?

P.S. Thanks for the very well written question!

like image 188
GregGalloway Avatar answered Nov 15 '22 08:11

GregGalloway