Skip to main content

Key Performance Indicators (KPIs)

  • 4 minutes to read

In Analysis Services, a KPI is a collection of calculations associated with a measure group in a cube used to evaluate business success. A typical KPI consists of the actual value achieved, the goal, status, trend and weight values. To learn more about KPIs, see the Key Performance Indicators topic in MSDN.


Displaying KPI Values

If an OLAP cube contains KPI (key performance indicator) information, the PivotGridControl can automatically recognize it and display it in an appropriate format. A typical KPI consists of the actual value achieved, the goal, status, trend and weight values. Use the PivotGridControl.GetOLAPKPIList method to obtain a list of KPI names provided by the OLAP cube.

In the OLAP cube, a KPI’s value is represented by a measure to which a Pivot Grid Control field should be bound to display the KPI value. The PivotGridControl.GetOLAPKPIMeasures method returns measures used to calculate the value, goal, status, trend and weight that represent the values of the specified KPI. The actual KPI values can be obtained using the PivotGridControl.GetOLAPKPIValue method.

You can obtain the type of the measure for a specified field using the PivotGridFieldBase.KPIType property. This property returns a PivotKPIType object that enumerates measure types (i.e., value, goal, status, trend and weight).


Demo: Code Examples - OLAP - OLAP KPI module in the XtraPivotGrid MainDemo

Requires installation of WinForms Subscription. Download.

Managing KPI Graphics

The Status and Trend measures contained in an OLAP cube can be visualized using server-defined graphics or specific custom graphics.

A graphic set consists of three images, each corresponding to a progress state. For instance, the cylinder graphics provide the KPIGraphic_Cylinder_1, KPIGraphic_Cylinder_-1 and KPIGraphic_Cylinder_0 images for the good, bad and neutral states, respectively. To obtain a graphic set defined on the server for the specified KPI’s, use the PivotGridControl.GetOLAPKPIServerGraphic method.

To visualize KPI values using custom graphics for the required Status or Trend fields, set the PivotGridFieldBase.KPIGraphic property. The values listed by PivotKPIGraphic enumeration are used to set this property’s value.

To obtain an image that corresponds to the specified KPI value (-1, 0, 1), use the PivotGridControl.GetKPIBitmap method.

Regular Data Sources

KPI values can be visualized for a regular data source as well. To do this in Optimized and Server modes, create a Pivot Grid field that contains only values that correspond to the good (1), bad (-1), and neutral (0) states. To supply the field with these values, use ExpressionDataBinding. Create an ExpressionDataBinding instance and pass the expression in its constructor as a parameter. Assign the created object to the field’s DataBinding property. To visualize field values with images, use the PivotGridFieldBase.KPIGraphic property.


The following example shows how to display KPI graphics in the Pivot Grid bound to the Northwind database. The image below illustrates the resulting UI.


View Example

To display KPI graphics, create a Pivot Grid field and bind it to the following expression:

(Iif(Sum([{0}])<100000,-1,Iif(Sum([{0}])<150000,0,1)))", fieldExtendedPrice.ExpressionFieldName)

The field values depend on the “Extended Price” field values. If the “Extended Price” field value is less than 100000, the field value is “-1”. If the “Extended Price” field value is less than 150000, the field value is “0”. In other cases, the field value is “1”.

Use the PivotGridFieldBase.KPIGraphic property to specify a graphic set used to visualize field values.

using System;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid;

namespace WindowsFormsApp_RegularDataSourceKPI {
    public partial class Form1 : Form {
        public Form1() {
        private void Form1_Load(object sender, EventArgs e) {
            // Binds the Pivot Grid to data.
            // Creates a new "Status" field to show KPI values.
            PivotGridField KPIField = pivotGridControl1.Fields.Add();
            KPIField.Area = PivotArea.DataArea;
            KPIField.Caption = "Status";
            // Sets a column's data binding and specifies an expression.
            KPIField.DataBinding = new ExpressionDataBinding(
            // Sets the Data Header Area within which the "Status" Field can be positioned.
            KPIField.AllowedAreas = DevExpress.XtraPivotGrid.PivotGridAllowedAreas.DataArea;
            // Specifies a graphic set used to indicate KPI values.
            KPIField.KPIGraphic = PivotKPIGraphic.Faces;