Home > Articles > Data > SQL Server

  • Print
  • + Share This
Like this article? We recommend

Member Names and Keys

Now let's examine the left pane of the Cube Editor. This pane displays cube dimensions, measures, calculated members, calculated cells, actions, and named sets. For this example, click on the Customers dimension and then navigate to the Name level. In the Properties box on the bottom of the left pane you'll see the Member Key column and the Member Name column properties, as shown next:

Figure 7Figure 7

What is the difference between the two? Within Analysis Services, you can look up the dimension member by using either its key or name. In MDX, you can refer to a dimension member by specifying its name or by appending "&" to the key of that member. Hence the Foodmart database uses Customer.customer_id as the Member Key column and customer.fname + '' + customer.lname as the Member Name column. Data retrieval usually works faster if you know the key; however, there will be times when you don't know the key—if so, you can use the Name column to get to the same data. For example, using the sales cube, you can get the same information by using the following MDX:

SELECT {[measures].members } ON COLUMNS,
{[customers].[name].&[1058]} ON ROWS
FROM sales

Or

SELECT {[measures].members} ON COLUMNS,
{[customers].[name].[amy petranoff]} ON ROWS
FROM sales

The output in both cases would be the following:

Figure 8Figure 8

Whether you use member names or keys in your MDX queries depends on the parameters you can collect from your users.

  • + Share This
  • 🔖 Save To Your Account