Skip to main content
A newer version of this page is available. .

Key Performance Indicators (KPIs)

  • 5 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 Key Performance Indicators topic in MSDN.

ASPxPivotGridKPI

Displaying KPI Values

If an OLAP cube contains KPI (key performance indicator) information, the ASPxPivotGrid 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 ASPxPivotGrid.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 PivotGridControl field should be bound to display the KPI value. The ASPxPivotGrid.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 ASPxPivotGrid.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).

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 particular 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 ASPxPivotGrid.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 ASPxPivotGrid.GetKPIImage method.

Regular Data Sources

KPI values can be visualized for a regular data source as well. To do this, create an unbound field containing only values corresponding to the good (1), bad (-1) and neutral (0) states. To provide unbound columns with these values, use an unbound expression and assign this expression to the GridViewDataColumn.UnboundExpression property. To visualize unbound field values with images, use the PivotGridFieldBase.KPIGraphic property.

Example

The following example shows how to display KPI graphics in ASPxPivotGrid control bound to a regular data source.

The ASPxPivotGrid control is bound to the “Sales Person” view in the Northwind database. To display KPI graphics, we create an unbound field whose values correspond to images contained within a KPI graphic set.

In this example, the unbound field values depend on the “Extended Price” field values: if the “Extended Price” field value is less than 100000, the unbound field value is “-1”, if the “Extended Price” field value is less than 150000, the unbound field value is “0”. In other cases, the unbound field value is “1”.

The PivotGridOptionsData.DataFieldUnboundExpressionMode property is set to DataFieldUnboundExpressionMode.UseSummaryValues to calculate unbound expressions for data fields against summary values. The PivotGridFieldBase.KPIGraphic property specifies a graphic set used to visualize unbound field values.

The following image shows the result of the KPI values visualization:

ex-ASP.Net-PivotGrid-RegularDataSorceKPI

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" 
Inherits="ASPxPivotGridRegularDataSourceKPI.WebForm1" %>

<%@ Register assembly="DevExpress.Web.ASPxPivotGrid.v14.1, Version=14.1.6.0, 
Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPivotGrid" 
tagprefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <dx:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" ClientIDMode="AutoID" 
            DataSourceID="AccessDataSource1" Theme="DevEx">
            <Fields>
                <dx:PivotGridField ID="fieldCategoryName" Area="RowArea" AreaIndex="0" 
                    Caption="Category Name" FieldName="CategoryName">
                </dx:PivotGridField>
                <dx:PivotGridField ID="fieldExtendedPrice" Area="DataArea" AreaIndex="0" 
                    FieldName="Extended Price">
                </dx:PivotGridField>
            </Fields>
        </dx:ASPxPivotGrid>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/nwind.mdb" 
            SelectCommand="SELECT * FROM [SalesPerson]"></asp:AccessDataSource>

    </div>
    </form>
</body>
</html>