Excel - CUBEVALUE Function



CUBEVALUE Function

The CUBEVALUE function returns a summarized value from the cube, such as a Count, Average, Max, Min, and Sum. Data analysts working with multiple-dimensional databases can seamlessly benefit from these functions. Various CUBE functions, such as CUBESETCOUNT, CUBEKPIMEMBER, CUBEMEMBER, and many more, fetch valuable data from OLAP cubes. One crucial cube function is the CUBEVALUE function.

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

Syntax

The syntax of CUBEVALUE function is as follows −

CUBEVALUE (connection, [member_expression1], [member_expression2], )

Arguments

You can use the following arguments with the CUBEVALUE function −

Argument Description Required / Optional
Connection It specifies a string value representing the connection name for the cube. Required
member_expression It indicates a multidimensional expression (MDX) through the string to fetch a specific member/tuple within the cube. Optional

You may use the member_expression as a slicer to define the cube portion for which the summarized value is pulled.

If the measure is not referred to in member_expression, then the default measure for that cube will be utilized.

Points to Remember

  • Once you compute the CUBEVALUE, it usually showcases a "#GETTING_DATA" message in the cell before the actual result is obtained.
  • The CUBEVALUE function will return a #NAME error for the invalid connection names saved in the specific workbook. If the Online Analytical Processing (OLAP) server is not in working mode or gets an error message, the CUBEVALUE function gets a #NAME Error.
  • If any member defined in the member expression is invalid, CUBEVALUE will return a #VALUE! Error.
  • CUBEVALUE will retrieve a #N/A error value if various cases
    • If the syntax of member expression is inaccurate.
    • The member specified by MDX isn't present in the cube.
    • For the invalid tuple because no intersection exists among the specified values.
  • When you designate a session-based object in a particular cell and preserve a connection, the Pivot Table is either deleted or converted into formulas.

Examples of CUBEVALUE Function

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

Example 1

Consider a sample pivot table that contains the product category of their respective region in the first column, and the sum of production is specified in the second column.

Excel CUBEVALUE Function 1

Is there an option to transform the Pivot table into formulas?

You may switch to the PivotTable Analyze tab, expand the OLAP Tools tile, and select the Convert to Formulas option.

Excel CUBEVALUE Function 2

Therefore, the Pivot table is converted into the Formulas. If you double-click on any cell values in the Sum of production column in the pivot table, the CUBEVALUE function is automatically displayed on that cell. For example, double click on the F5 cell where the CUBEVALUE formula =CUBEVALUE("ThisWorkbookDataModel",$E5,F$3) is being displayed and then again press the Enter tab.

Excel CUBEVALUE Function 3

Excel CUBEVALUE Function 4

Example 2

If any member defined in the member expression is invalid, CUBEVALUE will return a #VALUE! Error.

Solution

You may enter the expression =CUBEVALUE("ThisWorkbookDataModel",$E7,E8,F$3) in the H11 cell. Here, E8 is an invalid member expression. Only one associated value from the Sum of Production column corresponding to the Row labels(E7 or E8) can be retrieved in this function.

Excel CUBEVALUE Function 5

Once you press the Enter tab, the #VALUE error is obtained.

Example 3

CUBEVALUE will retrieve a #N/A error value if various cases

  • If the syntax of member expression is inaccurate.
  • The member specified by MDX isn't present in the cube.

Solution

Case 1 − In this example, if you enter the incorrect member expression in the CUBEVALUE function, the #N/A error will return. Lets imagine you enter the formula =CUBEVALUE("ThisWorkbookDataModel","AeC",F$3) in the H11 cell and press the Enter tab.

Excel CUBEVALUE Function 6

As you can see in the screenshot, the second argument, AeC, is invalid as there is no such value in the Row labels.

After that, press the Enter tab to get the resulting value.

Excel CUBEVALUE Function 7

Case 2 − The member specified by MDX isn't present in the cube.

You may enter the formula =CUBEVALUE("ThisWorkbookDataModel",H8,F$3) in the H11 cell. Here, the cell reference H8 points to the Car member, which is not presented in the cube. You may press the Enter tab.

Excel CUBEVALUE Function 8

Therefore, the CUBEVALUE function will return the # N/A error.

Excel CUBEVALUE Function 9
Advertisements