CUBEKPIMEMBER function
Returns a key performance indicator (KPI) property - value, goal, status or trend - from a Data Model or cube, for use in CUBEVALUE.
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
CUBEKPIMEMBER(connection, kpi_name, kpi_property, [caption])| Argument | What it means | |
|---|---|---|
connection | Required | The cube connection name, e.g. "ThisWorkbookDataModel". |
kpi_name | Required | The name of the KPI. In the Data Model this is the name of the measure the KPI is built on, e.g. "Total Revenue". |
kpi_property | Required | 1 value, 2 goal, 3 status, 4 trend, 5 weight, 6 current time member. |
caption | Optional | Text to display in the cell instead of the default caption. |
Returns: A KPI member. The cell shows its caption; CUBEVALUE returns the number behind it.
How CUBEKPIMEMBER works
A KPI is a measure with a target attached. In Power Pivot you can turn a measure such as Total Revenue into a KPI by giving it a goal (a fixed number or another measure) and status thresholds; on an Analysis Services cube, KPIs are designed by the cube's developer. CUBEKPIMEMBER fetches one part of a KPI - its current value, its goal, its status or its trend - so you can show it in a report next to regular cube formulas.
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. A KPI was added to Total Revenue with an absolute target of 5000 and status thresholds at 80% and 100% of the target, so the status is -1 below 80%, 0 between 80% and 100%, and 1 at or above the target.
The function itself only returns a member, and the cell shows a caption. To get the number, reference the cell from CUBEVALUE together with any slicing members, such as a region. The status comes back as -1, 0 or 1, which you can show with an icon set in conditional formatting.
Examples
1Goal of the revenue KPI
| A | |
|---|---|
| 1 | |
| 2 | Revenue goal |
Result: Revenue goal
Property 2 is the goal. The cell shows the caption; =CUBEVALUE("ThisWorkbookDataModel", A2, "[Sales].[Region].[All].[North]") in B2 returns 5000.
2Status for North
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | 0 |
Result: 0
North's revenue is 4638, which is 92.8% of the 5000 goal - between the 80% and 100% thresholds - so the status is 0 (amber).
3Current value for North
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | 4638 |
Result: 4638
Property 1 is the KPI's value, which is simply the measure: North's total revenue.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#N/A | The KPI name does not exist or the measure has no KPI defined. | Check the KPI in Power Pivot (Home > Create KPI) or in the cube's design. |
#GETTING_DATA | Data is still loading. | Wait a moment. |
Tips
- Apply a three-icon set to the status cells (-1, 0, 1) for traffic lights.
- Weight (5) and current time member (6) are only meaningful on Analysis Services cubes that define them.
Google Sheets
No OLAP cube functions or KPIs; calculate the KPI with ordinary formulas or a pivot table.
CUBEKPIMEMBER 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 | KUBE.KPI.MEDLEM |
| Dutch | KUBUSKPILID |
| Finnish | KUUTIOKPIJÄSEN |
| French | MEMBREKPICUBE |
| German | CUBEKPIELEMENT |
| Hungarian | KOCKA.FŐTELJMUT |
| Italian | MEMBRO.KPI.CUBO |
| Norwegian (Bokmål) | KUBEKPIMEDLEM |
| Polish | ELEMENT.KPI.MODUŁU |
| Portuguese (Brazil) | MEMBROKPICUBO |
| Portuguese (Portugal) | MEMBROKPICUBO |
| Russian | КУБЭЛЕМЕНТКИП |
| Spanish | MIEMBROKPICUBO |
| Swedish | KUBKPIMEDLEM |
| Turkish | KÜPKPIÜYESİ |