Excel - CUBEMEMBER Function



CUBEMEMBER Function

The CUBEMEMBER function will retrieve either a tuple or a specific member from the cube. You may utilize this function to validate that the members or tuples are presented in a defined cube. For example, suppose you wish to display the production of various electronic devices across different regions.

Syntax

The syntax of CUBEMEMBER function is as follows −

CUBEMEMBER (connection, member_expression, [caption])

Compatibility

This advanced excel function is compatible with the following versions of MS-Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2019 for Mac
  • Excel 2016
  • Excel for iPad
  • Excel Web App
  • Excel for iPhone
  • Excel for Android tablets
  • Excel for Android phones

Arguments

You can use the following arguments with the CUBEMEMBER function −

Argument Description Required / Optional
Connection It specifies a text representing the name of the connection to the cube. Required
member_expression It specifies a text which would either be a multidimensional expression (MDX) or a tuple representing the specified range of cells or an array constant. Required
Caption It represents a text showcased in the cell contrary to the caption from the cube. If a tuple is retrieved, the caption employed is the one for the final member in the tuple. Optional

Points to Remember

  • If you enter the CUBEMEMBER Function in the desired cell, it temporarily displays a "#GETTING_DATA" message before the result is obtained.
  • If the connection name is an invalid workbook, the CUBEMEMBER function will return a #NAME Error. If the availability of the Online Analytical Processing (OLAP) server is not in Excel, is not functioning, or displays an unexpected error, then the CUBEMEMBER function will retrieve a #NAME Error.
  • If at least one element within the tuple is invalid, The CUBEMEMBER returns a #VALUE! Error.
  • If member_expression is lengthy, more than 255 characters, CUBEMEMBER returns a #VALUE! Error. You may utilize the cell reference where the text string is written for the lengthy string.
  • To use text strings longer than 255 characters, enter the text string in a cell (for which the limit is 32,767 characters), and then use a cell reference as the argument.
  • CUBEMEMBER will retrieve a #N/A error value in various case
    • The syntax of member expression is invalid.
    • The member defined in the MDX text string is not presented in the cube.
    • There will be no intersection for the given values in invalid tuples.
  • The CUBEMEMBER function will return a #N/A error if you reference a session-based object, like a calculated member, or remove the Pivot table.

Examples of CUBEMEMBER Function

Practice the following examples to learn the use of the CUBEMEMBER function in Excel.

Example 1

Step 1 − Consider the sample table comprising three columns: Region, Name of Product, and Production.

Excel CUBEMEMBER Function 1

Step 2 − You may navigate to the Insert tab, expand the PivotTable tile, and choose the From Table/Range option from the list.

Excel CUBEMEMBER Function 2

Step 3 − The other dialog box, PivotTable from table or range, will appear. Write Table1 under the Select a table or range section. In the next section, select the Existing Worksheet to place the Pivot table in the active worksheet. You may specify the designated cell reference range where the Pivot table will be inserted. You must select the Add this data to the Data Model checkbox. After that, click the OK button.

Excel CUBEMEMBER Function 3

Step 4 − Furthermore, drag the Region field and drop it into the Rows sections, and in a similar way, drag the Production field and place it into the Values section as shown below:

Excel CUBEMEMBER Function 4

Step 5 − Finally, the pivot table is created in the designated cell range. Now, click the PivotTable Analyze and expand the OLAP Tools tile, and select the Convert to Formulas option from the drop-down menu.

Excel CUBEMEMBER Function 5

Step 6 − Once you select the member of the first column, Row Labels, like East, you can automatically view the CUBEMEMBER function for that member.

In this example, the CUBEMEMBER formula for the E4 cell is

= CUBEMEMBER("ThisWorkbookDataModel","[Table1].[Region].&[East]")

It means that the East member from the Region column is retrieved from a Table1 having the connection name "ThisWorkbookDataModel".

Excel CUBEMEMBER Function 6

Excel CUBEMEMBER Function 7

Similarly, you can view the CUBEMEMBER function for the remaining regions, such as North, South, and West.

Step 7 − Furthermore, you may enter the formula =CUBEMEMBER("ThisWorkbookDataModel","[Table1].[Name of Product].&[TV]") in the E11 cell and press the Enter key to get the product name from the Name of Product column.

Excel CUBEMEMBER Function 8

Excel CUBEMEMBER Function 9

Example 2

CUBEMEMBER will retrieve a #N/A error value if the member expressions syntax is invalid, and there will be no intersection for the given values in invalid tuples.

Solution

Write the expression =CUBEMEMBER("ThisWorkbookDataModel","[Table1].[Product].&[TV]") in the E11 cell and press the Enter tab.

Excel CUBEMEMBER Function 10

In this example, the member expression (second argument) that referred to the column name Product is not defined in Table 1. Therefore, the resulting value is a #N/A error.

Excel CUBEMEMBER Function 11

If you are working with tuples, ensure that the intersection between the given values must exist; otherwise, the #N/A error will occur.

Advertisements