|MDX Cell Properties Supported By Excel|
|Written by Chris Webb|
|Sunday, 27 April 2014 21:01|
Reposted from Chris Webb's blog with the author's permission.
I was wondering the other day (as you do) which of the MDX cell properties Excel PivotTables actually support. This page has all the details on the cell properties that are available in an MDX query but most client tools don't bother retrieving all of them and Excel is no different. Of course it retrieves the most important properties and it retrieves one or two others, but I couldn't resist doing a bit of research to find out the exact situation with Excel 2013.
The first thing to note is that you can control which cell properties Excel retrieves for a given connection in the connection properties dialog, in the OLAP Server Formatting section:
If you can live with not getting all of the cell properties back from SSAS there are some scenarios where unchecking all of the boxes in the OLAP Server Formatting section can improve performance:
You can also quite easily see which cell properties Excel is retrieving by looking at the MDX queries it generates (thank you OLAP PivotTable Extensions). Here's an example of a simple PivotTable query run on a connection which has all of the boxes checked in the OLAP Server Formatted section:
In the cell properties clause of this query you can see the six properties returned. Here's a breakdown of each of them.
VALUE and FORMAT_STRING
Excel doesn't actually retrieve the FORMATTED_VALUE cell property, which gives you the measure value with formatting applied by SSAS. Instead, assuming you have the Number Format box checked in the Connection Properties dialog, it retrieves the VALUE property from SSAS (which contains the raw, unformatted measure value) and the FORMAT_STRING property (which contains the format string you defined on the server). It then tries to convert the format string into an Excel format for the PivotTable. Unfortunately it can't always do the conversion successfully - I blogged about a problem with the Percent format some time ago and this is still a problem with Excel 2013. Excel also doesn't support formats defined in the fourth section (see here for more details) of the FORMAT_STRING property for null values, and there are probably lots of other relatively obscure types of formatting it doesn't support too.
The language property of a cell controls things like the currency symbol displayed when you are using the "Currency" built-in format string and the thousands and decimal separators used. Whether Excel returns the language property or not is also linked to the Number Format checkbox in the Connection Properties dialog. I strongly recommend that you do not use the "Currency" format string and the Language property if you are working with multiple currencies, for reasons I outlined here.
BACK_COLOR and FORE_COLOR
I've never particularly liked using the BACK_COLOR and FORE_COLOR properties on a cell to do traffic light-style reporting, to be honest, although I know some people love it. However I do use these properties a lot when debugging scoped assignments as seen here. BACK_COLOR is retrieved if you have the Fill Color box checked on the connection properties dialog; FORE_COLOR is retrieved if you have the Text Color box checked on the connection properties dialog.
Probably the only surprise of this whole exercise was the fact that Excel retrieved the FONT_FLAGS property if you have the Font Style box checked on the connection properties dialog; alas it doesn't support FONT_SIZE or FONT_NAME. For example if you put the following calculated members on your cube:
If you drop them into a PivotTable, you will see the following returned:
Latest Author Articles
- How To Optimise The Performance Of MDX Queries That Return Thousands Of Rows
- MDX Scoped Assignments Outside The Granularity Of A Measure Group
- Running Your Own MDX And DAX Queries In Power BI Desktop
- Thoughts On the Microsoft/Pyramid Power BI Deal
- One-To-One Relationships In Power BI