Excel CUBEKPIMEMBER Function
The CUBEKPIMEMBER function returns the key performance indicator (KPI) property and displays the KPI name in the cell.
The CUBEKPIMEMBER function returns a KPI property.
- The #GETTING_DATA… message is displayed while the data is being retrieved.
- To use KPI in a calculation, nest the CUBEKPIMEMBER function as a member_expression argument in the CUBEVALUE function.
- CUBEKPIMEMBER 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.
- CUBEKPIMEMBER returns the #N/A error value if:
- kpi_name or kpi_property is not valid;
- reference a session-based object in pivot table when sharing a connection and the pivot table is deleted or to be converted to formulas.
- Arguments of CUBEKPIMEMBER, except kpi_property and cell references, should be closed with double quotes ("").
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 CUBEKPIMEMBER function to get the total sales of both categories in 2021, you should first complete the following two steps:
- Add the data from this table to the Data Model in the existing workbook, its name will always be "ThisWorkbookDataModel".
- Add a KPI to your Data Model.
- Go to Data > Data Tools > Manage Data Model. Select the tab on the bottom of your specific data. Here I will select sale2021.
- Perform the necessary calculations. In this example, I will apply AutoSum on Sales column by first selecting the sales column and then click on AutoSum. You will see the Sum of Sales 2 measure is created as the below screenshot shown.
- Repeat the above step but apply Average from the drop-down list after you clicking the drop-down arrow besides AutoSum to create an Average measure.
- Right-click on the Sum measure and then select Create KPI. In the pop-up dialog, choose the Average of Sales 2 Measure in the drop-down menu, and then click OK.
Now the KPI is available in your data model, please copy or enter the formula below in the cell G21, and press Enter to get the result:
=CUBEKPIMEMBER("ThisWorkbookDataModel","Sum of Sales 2",1, "Total sales")
√ Note: You can get the corresponding KPI value by using the CUBEVALUE function in the cell H21:
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[Sum of Sales 2]")