CUBEVALUE & CUBESET: Query Data Model from Formulas

Understand how Excel CUBEVALUE and CUBESET functions work with Power Pivot and data models in this practical tutorial. Learn how to retrieve specific values, define member sets, build dynamic reports, connect formulas to slicers, and create flexible dashboard calculations. Ideal for Excel users, analysts, finance teams, and Power Pivot learners who want to build advanced reports using cube functions.

PivotTables are powerful but inflexible. Their layout is fixed and cannot be freely formatted. CUBEVALUE and CUBESET solve this. They let you query the Excel Data Model directly from worksheet formulas, returning exactly the values you want, placed exactly where you want them. The result looks like a normal spreadsheet but is fully powered by the Data Model.

This guide covers how CUBEVALUE and CUBESET work and six practical examples. These include a single KPI cell, a custom layout report, dynamic member sets, conditional filtering, multiple measures side-by-side, and refreshing CUBE formulas automatically.

Requirement: CUBE functions require the Excel Data Model with at least one table loaded. They work with both native Data Model tables and Power Pivot models. They are available in Excel 2013 and later on Windows. CUBE functions are not available on Excel for Mac or Excel online.

How CUBEVALUE and CUBESET Work

Essentially, CUBEVALUE retrieves a single aggregated value from the Data Model. It takes a connection name, a measure expression, and one or more member expressions that define the filter context. CUBESET, by contrast, defines a named set of members from a dimension — such as a filtered list of products or dates — which can then be used as a filter argument inside CUBEVALUE.

Core syntax: CUBEVALUE(connection, [member_expr1], [member_expr2], ...) connection: "ThisWorkbookDataModel" for the built-in model member_expr: MDX expression defining the filter context Example — total revenue for the North region: =CUBEVALUE("ThisWorkbookDataModel", "[Measures].[Total Revenue]", "[Sales].[Region].&[North]" ) CUBESET(connection, set_expression, , [sort_order], [sort_by]) Returns a named set of members for use in CUBEVALUE.
Where to find measure names: Open a PivotTable using the Data Model. The measure names appear in the Values area. Right-click any value field and choose Value Field Settings to confirm the exact DAX measure name. Use that name exactly inside the square brackets in CUBEVALUE.

Examples 1–4: CUBEVALUE and CUBESET in Practice

1
Single KPI cell — total revenue in a freestyle layout

This is the simplest CUBEVALUE use case. A single cell displays a Data Model measure. The measure updates automatically when the underlying data changes. This is particularly useful for dashboard header cells that show a KPI without the visual noise of a PivotTable.

Single measure cell (no filter context): =CUBEVALUE("ThisWorkbookDataModel","[Measures].[Total Revenue]") Result: the grand total of the Total Revenue measure. No filter applied — returns the same value as the grand total cell of a PivotTable with no slicers.
2
Revenue by region — filtered CUBEVALUE for each row

Each row in a custom report can show a different member. For example, row 5 shows North revenue, row 6 shows South revenue, and row 7 shows East revenue. Each uses the same CUBEVALUE formula with a different member expression. The layout is completely free — you can merge cells, add branding, or place values anywhere on the sheet.

Revenue by region — one formula per row: B5: =CUBEVALUE("ThisWorkbookDataModel", "[Measures].[Total Revenue]", "[Sales].[Region].&[North]") B6: =CUBEVALUE("ThisWorkbookDataModel", "[Measures].[Total Revenue]", "[Sales].[Region].&[South]") B7: =CUBEVALUE("ThisWorkbookDataModel", "[Measures].[Total Revenue]", "[Sales].[Region].&[East]")
3
CUBESET — define a filtered member set for reuse

CUBESET defines a reusable set of members. For instance, you might define a set of the top five products by revenue. That set can then be used as a filter argument in multiple CUBEVALUE formulas. This approach is more efficient than writing individual member expressions for each cell.

CUBESET defining top 5 products by revenue: E2: =CUBESET( "ThisWorkbookDataModel", "TopCount([Products].[ProductName].Members, 5, [Measures].[Total Revenue])", "Top 5 Products" ) Use in CUBEVALUE: =CUBEVALUE("ThisWorkbookDataModel", "[Measures].[Total Revenue]", E2) <-- references the CUBESET cell
4
Two measures side-by-side — Revenue and Units in one layout

A single CUBEVALUE row can reference multiple measures side-by-side using separate formula cells in adjacent columns. For example, column B shows Total Revenue and column C shows Total Units for the same region. This creates a dense, custom-formatted report that a PivotTable cannot replicate without significant manipulation.

Two measures for each region row: Column B (Revenue) Column C (Units) Row 5: =CUBEVALUE(...,Revenue,North) =CUBEVALUE(...,Units,North) Row 6: =CUBEVALUE(...,Revenue,South) =CUBEVALUE(...,Units,South) Row 7: =CUBEVALUE(...,Revenue,East) =CUBEVALUE(...,Units,East) Both columns refresh together when the Data Model refreshes.

Examples 5–6: Dynamic Members and Slicer Integration

5
Cell-driven member — use a dropdown to change the filter

You can build the member expression dynamically using a cell reference. For example, a dropdown in cell A2 contains region names. The CUBEVALUE formula uses CUBEMEMBER to convert the selected region name into a valid MDX member. This consequently creates a dynamic report that changes based on the dropdown selection.

Dynamic member from a dropdown cell (A2): A2: [Data Validation dropdown] → North / South / East B5: =CUBEVALUE( "ThisWorkbookDataModel", "[Measures].[Total Revenue]", CUBEMEMBER( "ThisWorkbookDataModel", "[Sales].[Region].&[" & A2 & "]" ) ) Changing A2 to "South" recalculates B5 for the South region.
6
Slicer integration — connect a slicer to CUBE formulas

CUBE formulas do not respond to slicers directly. However, you can connect a slicer to a hidden PivotTable and then reference the PivotTable’s current filter in the CUBE formula via CUBERANKEDMEMBER. This approach effectively lets slicers drive a custom CUBEVALUE-based layout. It is a common advanced dashboard technique.

Connecting a slicer to CUBE formulas: Step 1: Insert a hidden PivotTable using the Data Model. Step 2: Connect your slicer to that PivotTable. Step 3: Use CUBERANKEDMEMBER to read the slicer's current selection from the PivotTable. Step 4: Pass the result as the member_expr in CUBEVALUE. =CUBEVALUE("ThisWorkbookDataModel", "[Measures].[Total Revenue]", CUBERANKEDMEMBER("ThisWorkbookDataModel", PivotTable1.DataBodyRange, 1))

Common Issues and How to Fix Them

The CUBEVALUE formula returns #N/A or #VALUE!

The most common cause is an incorrect measure or member name. MDX member names are case-sensitive and must exactly match the name in the Data Model. Specifically, verify the measure name by inserting a PivotTable from the same Data Model and checking the exact field name in the Values area. Also confirm that the connection name is "ThisWorkbookDataModel" — this is the standard name for the built-in model.

CUBE formulas display #GETTING_DATA indefinitely

This usually means the Data Model has not finished loading. CUBE formulas are asynchronous and display #GETTING_DATA while they wait for the model to calculate. If the model never finishes, the data source may have an error. Specifically, go to Power Pivot > Manage and check for any refresh errors in the tables listed there. Refreshing the Data Model manually often resolves this.

Frequently Asked Questions

  • What is CUBEVALUE in Excel?+
    CUBEVALUE is an Excel function that retrieves a single aggregated value from the Data Model. It takes a connection name, a measure name in MDX format, and one or more member expressions that define the filter context. The result behaves like a regular cell value and can be formatted, charted, or used in other formulas. Unlike a PivotTable, CUBEVALUE lets you place the result in any cell, in any layout.
  • What is CUBESET used for?+
    CUBESET defines a named set of dimension members — for example, the top five products by revenue, or all products in a specific category. The set is stored in a cell and can then be referenced as a filter argument in CUBEVALUE. This avoids repeating complex MDX expressions across many cells and makes complex filtered reports easier to build and maintain.
  • Do CUBE functions work without Power Pivot?+
    Yes. CUBE functions work with the native Excel Data Model, which is available without enabling the Power Pivot add-in. You need at least one table loaded into the Data Model (via Data > Relationships, or by loading a Power Query table to the Data Model). Power Pivot adds advanced features like DAX measures and the Diagram View, but it is not required for basic CUBEVALUE use.
  • Why is CUBEVALUE showing #GETTING_DATA?+
    CUBE formulas are asynchronous — they display #GETTING_DATA while waiting for the Data Model to finish calculating. This is normal on first open or after a refresh. If it persists, the Data Model may have a load error. Check Power Pivot > Manage for any table errors. Also check that all data connections are valid and have not expired or lost credentials.