CUBEVALUE function
Returns an aggregated value, such as total revenue for a region, from a Data Model or OLAP cube.
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
CUBEVALUE(connection, [member_expression1], [member_expression2], ...)| Argument | What it means | |
|---|---|---|
connection | Required | The cube connection name, e.g. "ThisWorkbookDataModel". |
member_expression1, ... | Optional | Members or sets that slice the cube: usually a measure plus one or more items, given as MDX text or as references to cells containing CUBEMEMBER or CUBESET. If no measure is given, the cube's default measure is used. |
Returns: The number at the intersection of all the given members - e.g. the Total Revenue for North.
How CUBEVALUE works
CUBEVALUE is where the numbers come from in a cube-formula report. You pass it a connection and a list of members - a measure such as Total Revenue and items like North or Laptop - and it returns the value at their intersection, calculated by the Data Model or the OLAP server. Think of it as SUMIFS for a Data Model: each member is a condition.
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.
The typical layout puts CUBEMEMBER formulas in the row and column headers and one CUBEVALUE in the body that refers to them with mixed references, so it can be copied across the whole grid. Unlike a PivotTable, the layout is completely free: you can insert blank rows, add your own formulas next to the values, and mix values from different sources. If a combination has no data, CUBEVALUE returns an empty value that displays as a blank cell.
Examples
1Revenue for the region in a header cell
| A | B | |
|---|---|---|
| 1 | Region | Revenue |
| 2 | North | 4638 |
| 3 | South | |
| 4 | East |
Result: 4638
A2 contains a CUBEMEMBER formula for North. CUBEVALUE combines it with the Total Revenue measure and returns North's revenue. Copied down, B3 and B4 return 5990 for South and 2160 for East.
2Two conditions typed as text
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | 4500 |
Result: 4500
Each member narrows the result: South and Laptop. Only Dev's laptop sale matches.
3Grand total
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | 12788 |
Result: 12788
With only the measure, the value is not sliced by any region or product, so the whole table is summed.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#N/A | A member name is invalid, or a referenced CUBEMEMBER cell shows an error. | Fix the member expression; check the referenced header cells first. |
#VALUE! | One of the arguments refers to a cell that is not a cube member or set. | Make sure every reference points to a CUBEMEMBER or CUBESET cell. |
#NAME? | The connection name is wrong or the OLAP server cannot be reached. | Check the connection name in Data > Queries & Connections. |
#GETTING_DATA | The value is still being retrieved. | Wait a moment. |
Tips
- Use a mixed reference such as
$A2for row members andB$1for column members so one formula fills the grid. - Slicers can be passed as arguments: a slicer's name (e.g.
Slicer_Region) filters the value just like in a PivotTable. - Convert an existing PivotTable with OLAP Tools > Convert to Formulas to get working CUBEVALUE formulas instantly.
Google Sheets
No OLAP cube functions; use pivot tables, QUERY, or Connected Sheets for BigQuery data.
CUBEVALUE 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.
| Language | Function name |
|---|---|
| Danish | KUBEVÆRDI |
| Dutch | KUBUSWAARDE |
| Finnish | KUUTIONARVO |
| French | VALEURCUBE |
| German | CUBEWERT |
| Hungarian | KOCKA.ÉRTÉK |
| Italian | VALORE.CUBO |
| Norwegian (Bokmål) | KUBEVERDI |
| Polish | WARTOŚĆ.MODUŁU |
| Portuguese (Brazil) | VALORCUBO |
| Portuguese (Portugal) | VALORCUBO |
| Russian | КУБЗНАЧЕНИЕ |
| Spanish | VALORCUBO |
| Swedish | KUBVÄRDE |
| Turkish | KÜPDEĞERİ |