Excel CUBEVALUE Function
The CUBEVALUE function returns an aggregated value from a cube filtered by multiple member_expression arguments.
The CUBEVALUE function returns the aggregated value from a cube.
- The #GETTING_DATA… message is displayed while the data is being retrieved.
- CUBEVALUE returns the #NAME? error value if:
- connection is not a valid workbook connection stored in the workbook, e.g., ThisWorkbookDataModel;
- Online Analytical Processing (OLAP) server is unavailable, not running, or returned an error message.
- CUBEVALUE returns the #VALUE! error value if:
- There is one or more invalid elements in the tuple;
- member_expression is longer than 255 characters. Note: You can enter the text string in a cell and then reference the cell as the argument as a workaround.
- CUBEVALUE returns the #N/A error value if:
- member_expression is not valid;
- The member specified by member_expression does not exist in the cube;
- The set contains one or more members with a different dimension than the other members;
- The tuple in the member_expression argument is not valid since there is no intersection for the specified values.
- Arguments of CUBEMEMBER, except cell references, should be closed with double quotes ("").
- Names of members, dimensions or tables, etc. you write in member_expression should be wrapped in square brackets ([ ]).
- If the intersection for the specified values contains no value, CUBEVALUE returns a Null value, i.e., a zero-length string. Note that if you perform mathematical operations on the cell with the Null value, say A1 (Null value) + A2, the #VALUE! error will be returned. To prevent this, you can test for a zero-length string by using the ISTEXT function and replace the zero-length with 0 by using the IF function as shown in the following example: =IF(ISTEXT(A1),0,A1)+IF(ISTEXT(A2),0,A2).
I have a table here named “sales2021” which includes the information of sales and rating of different products of 2 categories across the year 2021. To use the CUBEVALUE function to get the total sales of caps in May and June, you should first add the data from this table to the Data Model in the existing workbook, its name will always be ThisWorkbookDataModel. Then please copy or enter the formula below in the cell H8 where you want to calculate the sales, and press Enter to get the result:
√ Note: The dollar signs before the row number and/or column alphabet in the cell reference make the row and/or column fixed, so that they won’t change when you drag or copy the formula. After entering the formula, you can drag the fill handle to the right to show results for other products.