Cube - CUBEVALUE Function

The CUBEVALUE function returns an aggregated value from the cube.
CUBEVALUE (connection, [member_expression1], [member_expression2], ...)

A text string of a multidimensional expression (MDX) that evaluates to a member or tuple within the cube.
OR
A set defined with the CUBESET function.
Use the Argument member_expression as a slicer to define the portion of the cube for which the aggregated value is returned.
Use the Argument member_expression as a slicer to define the portion of the cube for which the aggregated value is returned.
If no measure is specified in member_expression, the default measure for that cube is used.
If no measure is specified in member_expression, the default measure for that cube is used.
When the CUBEVALUE function evaluates, it temporarily displays a "#GETTING_DATA..." message in the cell before all of the data is retrieved.
When the CUBEVALUE function evaluates, it temporarily displays a "#GETTING_DATA..." message in the cell before all of the data is retrieved.
If a cell reference is used for member_expression, and that cell reference contains a CUBE function, then member_expression uses the MDX expression for the item in the referenced cell, and not the value displayed in that referenced cell.
If a cell reference is used for member_expression, and that cell reference contains a CUBE function, then member_expression uses the MDX expression for the item in the referenced cell, and not the value displayed in that referenced cell.
If the connection name is not a valid workbook connection stored in the workbook, CUBEVALUE returns a #NAME? Error value. If the Online Analytical Processing (OLAP) server is not running, not available, or returns an error message, CUBEVALUE returns a #NAME? Error value.
If the connection name is not a valid workbook connection stored in the workbook, CUBEVALUE returns a #NAME? Error value. If the Online Analytical Processing (OLAP) server is not running, not available, or returns an error message, CUBEVALUE returns a #NAME? Error value.
If at least one element within the tuple is invalid, CUBEVALUE returns a #VALUE! Error value.
If at least one element within the tuple is invalid, CUBEVALUE returns a #VALUE! Error value.
CUBEVALUE returns a #N/A error value when

The member_expression syntax is incorrect
The member specified by member_expression doesn't exist in the cube
The tuple is invalid because there is no intersection for the specified values. (This can occur with multiple elements from the same hierarchy).
The set contains at least one member with a different dimension than the other members.
CUBEVALUE may return a #N/A error value if you reference a session-based object, such as a calculated member or named set, in a PivotTable when sharing a connection. The PivotTable is deleted or you convert the PivotTable to formulas. (On the Options tab, in the Tools group, click OLAP Tools, and then clickConvert to Formulas.)


CUBEVALUE returns a #N/A error value when
The member_expression syntax is incorrect
The member_expression syntax is incorrect
The member specified by member_expression doesn't exist in the cube
The member specified by member_expression doesn't exist in the cube
The tuple is invalid because there is no intersection for the specified values. (This can occur with multiple elements from the same hierarchy).
The tuple is invalid because there is no intersection for the specified values. (This can occur with multiple elements from the same hierarchy).
The set contains at least one member with a different dimension than the other members.
The set contains at least one member with a different dimension than the other members.
CUBEVALUE may return a #N/A error value if you reference a session-based object, such as a calculated member or named set, in a PivotTable when sharing a connection. The PivotTable is deleted or you convert the PivotTable to formulas. (On the Options tab, in the Tools group, click OLAP Tools, and then clickConvert to Formulas.)

CUBEVALUE may return a #N/A error value if you reference a session-based object, such as a calculated member or named set, in a PivotTable when sharing a connection. The PivotTable is deleted or you convert the PivotTable to formulas. (On the Options tab, in the Tools group, click OLAP Tools, and then clickConvert to Formulas.)
Issue: Null values are converted to zero-length strings
In Excel, if a cell has no data because you never changed it or you deleted the contents, the cell contains an empty value. In many database systems, an empty value is called a Null value. An empty or Null value literally means "No value." However, a formula can never return an empty string or Null value. A formula always returns one of three values −

A number value
A text value, which may be a zero-length string
An error value, such as #NUM! or #VALUE


In Excel, if a cell has no data because you never changed it or you deleted the contents, the cell contains an empty value. In many database systems, an empty value is called a Null value. An empty or Null value literally means "No value." However, a formula can never return an empty string or Null value. A formula always returns one of three values −
A number value
A text value, which may be a zero-length string
An error value, such as #NUM! or #VALUE
If a formula contains a CUBEVALUE function connected to an Online Analytical Processing (OLAP) database and a query to this database results in a Null value, Excel converts this Null value to a zero-length string, even if the formula would otherwise return a number value. This can lead to a situation where a range of cells contain a combination of numeric and zero-length string values, and this situation can affect the results of other formulas that reference that range of cells. 
If a formula contains a CUBEVALUE function connected to an Online Analytical Processing (OLAP) database and a query to this database results in a Null value, Excel converts this Null value to a zero-length string, even if the formula would otherwise return a number value. This can lead to a situation where a range of cells contain a combination of numeric and zero-length string values, and this situation can affect the results of other formulas that reference that range of cells. 
For example, if A1 and A3 contain numbers, and A2 contains a formula with a CUBEVALUE function that returns a zero-length string, the following formula would return a #VALUE! Error −
=A1+A2+A3
For example, if A1 and A3 contain numbers, and A2 contains a formula with a CUBEVALUE function that returns a zero-length string, the following formula would return a #VALUE! Error −
=A1+A2+A3
To prevent this, you can test for a zero-length string by using the ISTEXT function. You can use the IF function to replace the zero-length with a 0 (zero) as follows −
To prevent this, you can test for a zero-length string by using the ISTEXT function. You can use the IF function to replace the zero-length with a 0 (zero) as follows −
=IF(ISTEXT(A1),0,A1)+IF(ISTEXT(A2),0,A2)+IF(ISTEXT(A3),0,A3)

Alternatively, you can nest the CUBEVALUE function in an IF condition that returns a 0 value if the CUBEVALUE function evaluates to a zero-length string as follows −
Alternatively, you can nest the CUBEVALUE function in an IF condition that returns a 0 value if the CUBEVALUE function evaluates to a zero-length string as follows −
=IF (CUBEVALUE ("Sales","[Measures].[Profit]","[Time].[2004]",
   "[All Product].[Beverages]")="", 0, CUBEVALUE("Sales",
   "[Measures].[Profit]","[Time].[2004]","[All Product].[Beverages]"))

Excel 2007, Excel 2010, Excel 2013, Excel 2016

    296 Lectures 
     146 hours 

 Arun Motoori

    56 Lectures 
     5.5 hours 

 Pavan Lalwani

    120 Lectures 
     6.5 hours 

 Inf Sid

    134 Lectures 
     8.5 hours 

 Yoda Learning

    46 Lectures 
     7.5 hours 

 William Fiset

    25 Lectures 
     1.5 hours 

 Sasha Miller
 Print
 Add Notes
 Bookmark this page