# Bind a Pivot Grid to an OLAP Cube | WinForms Controls | DevExpress Documentation

A cube is a multidimensional structure defined by its measures and dimensions. A cube’s measure can be bound to a data field in the [PivotGridControl](/WindowsForms/DevExpress.XtraPivotGrid.PivotGridControl), while a dimension can be bound to a column, filter, or row field. This tutorial contains step-by-step instructions on how to bind the Pivot Grid to an existing OLAP (OnLine Analytical Processing) cube. 

## Create a New Project and Add a Pivot Grid Control

Run Microsoft Visual Studio and create a new **Windows Forms App (.NET Framework)** project.

![Create Windows Forms App](/WindowsForms/images/win-pivot-create-a-new-project-vs.png)

Specify the project’s name and location in the New Project wizard.

![Configure Windows Forms App](/WindowsForms/images/win-pivot-create-a-new-project.png)

Drag the **PivotGridControl** item from the **DX.26.1: Data & Analytics** toolbox group onto the form.

![GettingStarted_L1_Toolbox](/WindowsForms/images/gettingstarted_l1_toolbox17870.png)

Note

The control’s [PivotGridOptionsData.DataProcessingEngine](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridOptionsData.DataProcessingEngine) property is set to `Optimized` when you drop the Pivot Grid from the toolbox. When the Pivot Grid uses the Optimized calculation engine, data is calculated on the client side, except data from the [OLAP](/CoreLibraries/403809/devexpress-pivot-grid-core-library/pivot-grid-modes/olap-mode) and server-mode [data sources](/CoreLibraries/403803/devexpress-pivot-grid-core-library/pivot-grid-modes/server-mode#server-mode-data-sources).

Open the Pivot Grid’s smart tag menu and click **Dock in Parent Container** to let the Pivot Grid fill the entire window’s client area.

![GettingStarted_L1_Dock](/WindowsForms/images/gettingstarted_l1_dock17861.png)

## Prepare a Data Source

Click the smart tag icon displayed in the top-right corner of the Pivot Grid to invoke the popup **PivotGridControl Tasks** window.

![GettingStarted_L2_SmartTag](/WindowsForms/images/gettingstarted_l2_smarttag119208.png)

Select the **Data Source Wizard** item.

![GettingStarted_L2_ConnectionString_Ellipsis](/WindowsForms/images/gettingstarted_l2_connectionstring_ellipsis17873.png)

Select the **OLAP Cube** technology and click **Next** in the invoked wizard.

![GettingStarted_L2_ConnectionString_Editor_Empty](/WindowsForms/images/gettingstarted_l2_connectionstring_editor_empty17871.png)

Select **ADOMD.NET** as the data provider and click **Next**.

![GettingStarted_L2_ConnectionString_Editor_Filled](/WindowsForms/images/gettingstarted_l2_connectionstring_editor_filled17872.png)

Specify the **Server Name** as *https://demos.devexpress.com/Services/OLAP/msmdpump.dll* and select the **MSOLAP** provider. Then, click the **Retrieve Schema** button.

![GettinStarted_L2_RetrieveSchema](/WindowsForms/images/gettinstarted_l2_retrieveschema120133.png)

Make sure that the following parameters are specified:

| **Option** | **Value** | **Description** |
| --- | --- | --- |
| Provider | *MSOLAP* | Identifies the data provider to be used. The “*MSOLAP*“ string identifies the latest version of the OLE DB provider. |
| Server Name | https://demos.devexpress.com/Services/OLAP/msmdpump.dll | 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 supplies OLAP data. |

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

![GettinStarted_L2_Wizard](/WindowsForms/images/gettinstarted_l2_wizard120134.png)

## Create and Arrange Pivot Grid Fields

Create fields that correspond to specific measures and dimension levels of the cube in [PivotGridControl](/WindowsForms/DevExpress.XtraPivotGrid.PivotGridControl).

Click the smart tag icon and then click **Run Designer…** in the popup window.

![GettingStarted_L2_RetrieveFields](/WindowsForms/images/gettingstarted_l2_rundesigner17878.png)

Use the **Add Field** button to add Pivot Grid fields and specify their properties in the invoked [PivotGrid Designer](/WindowsForms/1825/controls-and-libraries/pivot-grid/design-time-features/pivotgrid-designer).

### “Country” Field

Create a Pivot Grid field and set its properties to the following values:

- [DataBinding](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.DataBinding)

    - Value: `Data Source Column`

- [ColumnName](/CoreLibraries/DevExpress.PivotGrid.DataBinding.DataSourceColumnBindingBase.ColumnName)

    - Value: `[Customer].[Country].[Country]`

- [AreaIndex](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.AreaIndex)

    - Value: `0`

- [Area](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.Area)

    - Value: `RowArea`

### “City” Field

Create a Pivot Grid field and set its properties to the following values:

- [DataBinding](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.DataBinding)

    - Value: `Data Source Column`

- [ColumnName](/CoreLibraries/DevExpress.PivotGrid.DataBinding.DataSourceColumnBindingBase.ColumnName)

    - Value: `[Customer].[City].[City]`

- [AreaIndex](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.AreaIndex)

    - Value: `1`

- [Area](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.Area)

    - Value: `RowArea`

### “Fiscal Year” Field

Create a Pivot Grid field and set its properties to the following values:

- [DataBinding](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.DataBinding)

    - Value: `Data Source Column`

- [ColumnName](/CoreLibraries/DevExpress.PivotGrid.DataBinding.DataSourceColumnBindingBase.ColumnName)

    - Value: `[Date].[Fiscal].[Fiscal Year]`

- [AreaIndex](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.AreaIndex)

    - Value: `0`

- [Area](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.Area)

    - Value: `ColumnArea`

### “Fiscal Quarter” Field

Create a Pivot Grid field and set its properties to the following values:

- [DataBinding](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.DataBinding)

    - Value: `Data Source Column`

- [ColumnName](/CoreLibraries/DevExpress.PivotGrid.DataBinding.DataSourceColumnBindingBase.ColumnName)

    - Value: `[Date].[Fiscal].[Fiscal Quarter]`

- [AreaIndex](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.AreaIndex)

    - Value: `1`

- [Area](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.Area)

    - Value: `ColumnArea`

### “Internet Sales Amount” Field

Create a Pivot Grid field and set its properties to the following values:

- [DataBinding](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.DataBinding)

    - Value: `Data Source Column`

- [ColumnName](/CoreLibraries/DevExpress.PivotGrid.DataBinding.DataSourceColumnBindingBase.ColumnName)

    - Value: `[Measures].[Internet Sales Amount]`

- [AreaIndex](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.AreaIndex)

    - Value: `0`

- [Area](/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridFieldBase.Area)

    - Value: `DataArea`

The image below shows the result.

![GettingStarted_L2_RetrievedFields](/WindowsForms/images/gettingstarted_l2_designer17877.png)

Close the designer. Pivot grid fields are now arranged as follows:

![GettingStarted_L2_OrderedFields](/WindowsForms/images/gettingstarted_l2_finallayout17874.png)

## Result

Run the project to see the result.

![GettingStarted_L2_Result](/WindowsForms/images/gettingstarted_l2_result17876.png)

## More Examples

[View Example: How to Connect a Pivot Grid to an OLAP Data Source in Code](https://github.com/DevExpress-Examples/winforms-pivot-grid-connect-to-an-olap-datasource)

See Also

[OLAP Mode](/CoreLibraries/403809/devexpress-pivot-grid-core-library/pivot-grid-modes/olap-mode)