A newer version of this page is available. Switch to the current version.

Binding to OLAP Data Sources

  • 9 minutes to read

The PivotGridControl allows you to visualize data contained in a cube deployed on an OLAP server. In OLAP mode, the PivotGridControl delegates data management operations (such as summarization, grouping, etc.) to the server side. Thus, you can use OLAP binding mode to process large amounts of data. The following KB article describes recommendations related to using OLAP data sources: How to improve the PivotGrid performance.

Requirements and Limitations

To learn more about requirements and limitations imposed by binding to OLAP data sources, see OLAP Requirements and Limitations.

Binding to an OLAP cube at Design Time

You can bind to an OLAP cube at design time in two ways.

Data Source Configuration Wizard

To bind to an OLAP cube using the Data Source Configuration Wizard, perform the following steps.

  1. Click the Data Source Button.


  2. In the invoked Data Source Configuration Wizard, select OLAP Cube.


    Click Next.

  3. Select the provider used to communicate with the Microsoft Analysis Services server.


    The following providers are available.

    • OLE DB for OLAP - A native provider for Analysis Services database connections.
    • ADOMD.NET - A Microsoft .NET Framework data provider that is designed to communicate with Microsoft SQL Server Analysis Services. ADOMD.NET uses the XML for Analysis protocol to communicate with analytical data sources by using either TCP/IP or HTTP connections to transmit and receive SOAP requests and responses that are compliant with the XML for Analysis specification.


      Note that the ADOMD.NET data provider provides a better performance than OLE DB for OLAP and provides additional capabilities. To learn more, see Data providers used for Analysis Services connections.

    • XMLA - Provides the capability to connect to an OLAP cube over HTTP protocol. This method does not require any data access libraries or data providers to be installed on the client system.

    Select ADOMD.NET and click Next.

  4. On the final page, specify the required settings.


    • Provider - Allows you to specify the version of the Microsoft Analysis Services OLE DB Provider for the Microsoft SQL Server. Note that MSOLAP identifies the latest version of the OLE DB provider.
    • Server Name - Specifies the name of the OLAP server that runs an instance of Microsoft SQL Server Analysis Services (SSAS). You can also specify the full path to a local cube file.


      Click the Retrieve Schema button to obtain the available catalogs/cubes contained in the specified server.

    • Catalog Name - Specifies a data catalog that contains cubes.
    • Cube Name - Specifies the name of a cube that provides data.
    • Query Timeout - The maximum amount of time (in seconds) allowed for a query to SSAS to complete. If the parameter is set to 0, each query can last indefinitely.
    • Culture - Specifies the locale used to retrieve translations from an OLAP server.
    • Connection Timeout - Specifies the time (in seconds) to wait while trying to establish a connection before terminating the attempt and generating an error.
    • User Id - Specifies the user name used to authenticate an OLAP server.
    • Password - Specifies the password used to authenticate an OLAP server.
    • Connections String - Contains the connection string generated based on settings specified above.

    After you have specified all the required settings, click Finish.

  5. Rebuild the solution, click the control's smart tag and make sure that the PivotGridControl is bound to the OLAP cube.


    You can click the ellipsis button next to Choose OLAP Data Source to modify the connection string in the Connection String Editor. To learn more, see the Connection String Editor paragraph below.

Connection String Editor

The Connection String Editor dialog allows you to modify the OLAP connection string at design time.


You can invoke this dialog using from the control's smart tag or by clicking the ellipsis button next to the PivotGridControl.OLAPConnectionString property in the standard Properties window.


To display all settings available in the Connection String Editor, enable the Show Advanced Properties checkbox.

This dialog contains the same settings as the Data Source Configuration Wizard. Moreover, it contains the following settings.

  • Roles - Specifies a comma-delimited list of predefined roles to connect to a server or database using permissions allowed by this role. To learn more, see Connection String Properties (Analysis Services).
  • CustomData - Specifies a function that can be used to pass a configuration setting to be used by Multidimensional Expressions (MDX) functions and statements. To learn more, see CustomData (MDX).

After you created an OLAP data source at design time, you can create pivot grid fields. To do this, open the Fields Page of the control's Designer. The Field List pane will contain all available measures and dimension levels of the cube. You can add a specific measure/dimension level to the PivotGridControl by dragging it onto the PivotGrid Fields pane.

Binding to an OLAP cube in Code

To bind the PivotGridControl to an OLAP cube in code, do the following.

If you have a cube on the OLAP server (Microsoft Analysis Services), you can view its data using the Pivot Grid. This example demonstrates how to specify connection settings and create fields that represent measures and dimensions of the cube.

To bind the Pivot Grid control to an OLAP cube, follow the steps below.

  • Set ADOMD as data provider using the PivotGridControl.OLAPDataProvider property.
  • Specify connection settings using the PivotGridControl.OLAPConnectionString property. The following connection string is used in this example:

    Provider=MSOLAP;Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;Initial catalog=Adventure Works DW Standard Edition;Cube name=Adventure Works;Query Timeout=100;

  • Create fields for measures and dimension in the bound OLAP cube. Use the PivotGridControl.RetrieveFields method overload that create fields, moves them to the specified area and makes them hidden. Another option is creating a new field and specifying its PivotGridFieldBase.OLAPExpression property.
  • Place the fields to the Pivot Grid Control areas as required and make them visible by setting the PivotGridFieldBase.Visible property.

Use the invoked Customization Form to arrange fields.


The complete sample project How to connect a Pivot Grid to an OLAP datasource is available at the DevExpress Examples repository on GitHub.

using DevExpress.XtraPivotGrid;
using DevExpress.XtraPivotGrid.Customization;

namespace WinOlapRetrieveFieldsExample
    public partial class Form1 : DevExpress.XtraEditors.XtraForm
        public Form1()
            // Specify the OLAP connection settings.
            pivotGridControl1.OLAPDataProvider = OLAPDataProvider.Adomd;
            pivotGridControl1.OLAPConnectionString =
                Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll; 
                Initial catalog=Adventure Works DW Standard Edition;
                Cube name=Adventure Works;
                Query Timeout=100;";

            // Set the Customization Forms style.
            pivotGridControl1.OptionsCustomization.CustomizationFormStyle = CustomizationFormStyle.Excel2007;
            // Invoke the Customization Form.

        private void btnRetrieveFields_Click(object sender, System.EventArgs e)
            // Retrieve fields.
            pivotGridControl1.RetrieveFields(PivotArea.ColumnArea, false);

            // Add fields from the Field List to the specified area to create a report.
            pivotGridControl1.Fields["[Customer].[Country].[Country]"].Area = PivotArea.RowArea;
            pivotGridControl1.Fields["[Customer].[Country].[Country]"].OLAPDimensionCaption = "TEST";
            pivotGridControl1.Fields["[Customer].[Country].[Country]"].Visible = true;
            pivotGridControl1.Fields["[Customer].[City].[City]"].Area = PivotArea.RowArea;
            pivotGridControl1.Fields["[Customer].[City].[City]"].Visible = true;
            pivotGridControl1.Fields["[Date].[Fiscal].[Fiscal Year]"].Area = PivotArea.ColumnArea;
            pivotGridControl1.Fields["[Date].[Fiscal].[Fiscal Year]"].Visible = true;
            pivotGridControl1.Fields["[Measures].[Internet Sales Amount]"].Visible = true;

            // Resize columns automatically.

            // Invoke the Customization Form.

        private void btnCreateFields_Click(object sender, System.EventArgs e)

            // Create a field, specify a query expression to obtain data and a caption to display it in the Customization form.
            PivotGridFieldBase fieldCountry = pivotGridControl1.Fields.Add("Country", PivotArea.RowArea);
            fieldCountry.OLAPExpression = "[Customer].[Country].[Country]";
            fieldCountry.OLAPDimensionCaption = "Location";

            PivotGridFieldBase fieldCity = pivotGridControl1.Fields.Add("City", PivotArea.RowArea);
            fieldCity.OLAPExpression = "[Customer].[City].[City]";
            fieldCity.OLAPDimensionCaption = "Location";

            PivotGridField measureField = new PivotGridField() { Caption = "Cleared Amount", Area = PivotArea.DataArea };
            measureField.OLAPExpression = "[Measures].[Internet Sales Amount] * 0.87";
            measureField.OLAPDimensionCaption = "Sales";

            PivotGridFieldBase fieldTop10 = pivotGridControl1.Fields.Add("Top10", PivotArea.ColumnArea);
            fieldTop10.OLAPExpression = "TOPCOUNT([Date].[Date].[Date].MEMBERS, 10, [Measures].[Internet Sales Amount])";
            fieldTop10.OLAPDimensionCaption = "Top";
            fieldTop10.Visible = false;;


            // Invoke the Customization Form.
See Also