Lesson 2 - Bind a Pivot Grid to an OLAP Cube

  • 3 minutes to read

A cube is a multidimensional structure defined by its measures and dimensions. You can think of a measure as a data field in PivotGridControl, while a dimension can be represented by a column field or a row field. This tutorial will help you learn how to bind a pivot grid to an existing OLAP (OnLine Analytical Processing) cube. In this example, we will use the Adventure Works cube.

To display data from an OLAP cube, do the following.

Specify a connection string to an OLAP cube.

  1. Run MS Visual Studio. Create a new WPF Application project and add PivotGridControl as you did in Lesson 1.
  2. Click the smart tag icon (SmartTag) displayed at the top-right of the pivot grid to invoke the Pivot Grid Control Tasks popup window.


  3. In the invoked wizard, select OLAP Cube technology and click Next.


  4. Select the ADOMD.NET as a data provider and click Next.


  5. In the next window, select the MSOLAP provider and specify the Server Name as https://demos.devexpress.com/Services/OLAP/msmdpump.dll. Then, click the Retrieve Schema button.


    Make sure that the following parameters are specified.



    Identifies the data provider to be used. The “MSOLAP“ string identifies the latest version of the OLE DB provider.

    Server Name


    Specifies either the name of a server that runs an instance of Microsoft SQL Server Analysis Services (SSAS), the path to a cube file or the path to a data pump.

    Catalog Name

    Adventure Works DW Standard Edition

    Specifies a data catalog that contains cubes.

    Cube Name

    Adventure Works

    Specifies the name of a cube that provides OLAP data.

    The image below demonstrates configured settings of the OLAP connection. Click Finish to close the wizard.


Create Fields

  1. Click the pivot grid’s smart tag and use the Add Data Area Field menu item to add a new field to the Data Header Area. In a similar manner, add two fields both to the Column Header and Row Header areas.


  2. To associate created fields with OLAP measures/dimensions, click the field’s smart tag icon. In the invoked menu, click the FieldName property ellipsis button to see existing data source fields.


    Select the following measures and dimensions for created fields.

    • For the data field, select the [Measures].[Internet Sales Amount] measure.
    • For the column fields, select the [Date].[Fiscal].[Fiscal Year] and [Date].[Fiscal].[Fiscal Quarter] dimensions.
    • For the row fields, select the [Customer].[Country].[Country] and [Customer].[City].[City] dimensions.

    After this, your XAML should look like the following. If it does not, you can overwrite your code with:

            Title="DevExpress WPF Application" Height="350" Width="525">
            <dx:PivotOlapDataSource x:Key="PivotOlapDataSource" Cube="Adventure Works" 
                                    Catalog="Adventure Works DW Standard Edition" 
                                    ConnectionTimeout="60" LocaleIdentifier="1033" 
                                    Password="{x:Null}" Provider="MSOLAP" QueryTimeout="30" 
                    <dx:DesignDataSettings RowCount="5"/>
            <dxpg:PivotGridControl OlapDataProvider="Adomd" 
                       OlapConnectionString="{Binding ConnectionString, Source={StaticResource PivotOlapDataSource}}">
                    <dxpg:PivotGridField Area="DataArea" Caption="Internet Sales Amount" 
                                         FieldName="[Measures].[Internet Sales Amount]"/>
                    <dxpg:PivotGridField Area="ColumnArea" Caption="Fiscal Year" 
                                         FieldName="[Date].[Fiscal Year].[Fiscal Year]"/>
                    <dxpg:PivotGridField Area="ColumnArea" Caption="Fiscal Quarter of Year"
                                         FieldName="[Date].[Fiscal Quarter of Year].[Fiscal Quarter of Year]"/>
                    <dxpg:PivotGridField Area="RowArea" Caption="Country" 
                    <dxpg:PivotGridField Area="RowArea" Caption="City" 
                                         FieldName="[Customer].[City].[City]" />


Run the project and see the result.


See Also