Cube function

CUBEMEMBER function

Returns a member (such as a region, product or measure) from a Data Model or OLAP cube, to be used by CUBEVALUE and other cube formulas.

Available in Excel 2007 and later for Windows, Microsoft 365, Excel for the web (with Data Model or supported OLAP sources); Excel for Mac 2016+ for the Data Model

Excel 2007 and laterNot in Google Sheets

Syntax

CUBEMEMBER(connection, member_expression, [caption])
ArgumentWhat it means
connectionRequiredThe name of the connection to the cube, in quotes. For the workbook's own Data Model it is "ThisWorkbookDataModel".
member_expressionRequiredAn MDX name of a member, such as "[Sales].[Region].[All].[North]" or "[Measures].[Total Revenue]", or an array of members that forms a tuple.
captionOptionalText to display in the cell instead of the member's own caption.

Returns: A member object. The cell displays its caption (e.g. North) while other cube functions can use the member behind it.

How CUBEMEMBER works

The CUBE functions let you build reports straight from the Excel Data Model (Power Pivot) or from an Analysis Services cube, cell by cell, without a PivotTable. CUBEMEMBER is the building block: it fetches one member - an item such as the North region, the Laptop product or a measure like Total Revenue - and keeps it in the cell. The cell shows a readable caption, but behind it Excel remembers the full member, so CUBEVALUE can refer to the cell to fetch numbers.

The examples use the sample Sales table (Rep, Region, Product, Units, Revenue) loaded into the workbook's Data Model - for example by ticking Add this data to the Data Model when inserting a PivotTable, or by loading it from Power Query. The Data Model's connection is always called ThisWorkbookDataModel, and a measure named Total Revenue (=SUM(Sales[Revenue])) was added with Power Pivot or the Add Measure command.

Member names use MDX syntax: [Table].[Column].[All].[Item] (or the key form [Table].[Column].&[Item]). You do not have to type these yourself: build a PivotTable from the Data Model and choose PivotTable Analyze > OLAP Tools > Convert to Formulas - Excel replaces the pivot with CUBEMEMBER and CUBEVALUE formulas you can study and reuse. While Excel is fetching the data, cells briefly show #GETTING_DATA.

Examples

1A region as a member

A2fx=CUBEMEMBER("ThisWorkbookDataModel", "[Sales].[Region].[All].[North]")
A
1Region
2North

Result: North

The cell displays North, but it holds the Data Model member, ready to be referenced by CUBEVALUE.

2A measure with a custom caption

B1fx=CUBEMEMBER("ThisWorkbookDataModel", "[Measures].[Total Revenue]", "Revenue (EUR)")
AB
1Revenue (EUR)

Result: Revenue (EUR)

Measures are members too. The third argument replaces the default caption with a friendlier label.

3A tuple of two members

A3fx=CUBEMEMBER("ThisWorkbookDataModel", {"[Sales].[Region].[All].[South]", "[Sales].[Product].[All].[Laptop]"}, "South laptops")
A
1
2
3South laptops

Result: South laptops

An array of members from different columns forms a tuple - the combination South and Laptop. A CUBEVALUE pointing at this cell returns 4500.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
#N/AThe member does not exist (spelling, wrong table or column name) or the connection name is wrong.Copy the exact names from a pivot converted to formulas; check Data > Queries & Connections for the connection name.
#NAME?The connection is not available, e.g. the external cube server cannot be reached.Check the network connection or the connection properties.
#GETTING_DATAExcel is still retrieving data.Wait - it is a temporary message, not an error.

Tips

  • Use Convert to Formulas on a PivotTable to learn the exact MDX names for your model.
  • Put member formulas in row and column headers, and one CUBEVALUE in the body that refers to both - then copy it across the grid.

Google Sheets

No OLAP cube functions; use pivot tables, QUERY, or Connected Sheets for BigQuery data.

CUBEMEMBER in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishKUBEMEDLEM
DutchKUBUSLID
FinnishKUUTIONJÄSEN
FrenchMEMBRECUBE
GermanCUBEELEMENT
HungarianKOCKA.TAG
ItalianMEMBRO.CUBO
Norwegian (Bokmål)KUBEMEDLEM
PolishELEMENT.MODUŁU
Portuguese (Brazil)MEMBROCUBO
Portuguese (Portugal)MEMBROCUBO
RussianКУБЭЛЕМЕНТ
SpanishMIEMBROCUBO
SwedishKUBMEDLEM
TurkishKÜPÜYESİ