SSAS – How to create User Defined member properties
It has been a long time since I wrote a blog as I was so very busy with other priorities. It feels so better to be back into this. Hope I will be able to blog frequently from now on.
Recently I have encountered a question in MSDN forums with a question how to create multiple caption for a member due to the reporting needs. As this is just for reporting purpose I have recommended creating them as User Defined member property. When I went ahead and searched in the internet for an article to provide step by step of this I couldn’t find one. So I decided to document it here so that it will be useful for all.
What is Member property?
Member properties cover the basic information about each member in each tuple. For example you need additional information on a member in a tuple of State Province code on State- Province attribute in the Geography Dimension in Adventureworks. But you don’t need any aggregation on that. For this scenario you can create this State Province code as member property for the State province so that it can be used for reporting purpose and it will not take more space in the cube as there is no aggregation for this property. Now let us take the above example itself and see how this can be achieved step by step.
Steps to create a member property
1. Open the Adventure works solution for SQL Server 2008 R2
2. Launch solution explorer and open the Geogrpahy dimension which we will be using as an example in this step by step
3. Right click on the State province code column in Data Source View section and select New Attribute from column. Instead you can drag and drop this column into the attributes section.
4.The attribute State Province code will appear in the attributes section under the Geography. Right click on Stateprovincecode attribute and select properties.Also you can hit F4 to display the property window.
5.On the properties window change the below property values
6.Move to the attribute relationship tab , you will see by default State Province code is added under GeographyID. But we need to add this attribute as member property to State Province.
7. Right click on the relationship in attribute relationships tab and say edit relationship. Change the Source attribute to State-Province.
8.Now you can see the relationship changes reflected in the attribute relationship tab.
9. With this the required changes are done and now we need to Deploy & process the cube.From the project à Build menu choose Deploy the cube.
10. Once the deployment and process is done , Double click on the cube and move to cube browser tab. In the left measure group pane , expand the Geography àState Province à Member properties. There you will be able to see the state province code added as a member property.
11. Now you will be able to use this member property in your MDX queries as shown below
MEMBER [Measures].[State Province Code] AS
[Geography].[State-Province].Properties( "State Province Code" )
[Measures].[State Province Code] ON COLUMNS,
[Geography].[State-Province].[State-Province] ON ROWS
FROM [Adventure Works]
Member properties will be handy when only used for reporting purpose without any aggregation. These member properties will not occupy any space in the cube as there is no aggregation or indexing done on these properties and it will be stored with in the dimension. As side effect of no indexes on these attributes querying member properties may be slow. But for sure this will help in terms of processing and cube size.
Hope this article is helpful. Will meet you soon with one more article next week as I have resolved to write one article a week.