How to Create Pivot Table with OLAP Data in JavaScript | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (15)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (67)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (920)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (37)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (151)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (41)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Create Pivot Table with OLAP Data

How to Create Pivot Table with OLAP Data in JavaScript

Business analysts and solution architects prefer to analyze larger data sets in a shorter time span in order to make better decisions faster. But they also expect to extract a concise summary out of thousands of unorganized rows and columns, which is a very time-consuming process. To tame this process, Syncfusion offers the Essential JS 2 Pivot Table, which displays summarized business data both in a tabular (grid) and graphical (chart) format. Reorganizing and summarizing large amounts of data is no longer difficult using this powerful tool.

You can easily customize and obtain a desired report on the fly and modify it at runtime to visualize aggregated and comparative information. In addition to its existing great feature list, with 2019 Volume 3 release, the Pivot Table can now connect to the SSAS OLAP cube data source. So, you can visualize it with dimensions, hierarchies, measures, named sets, and much more. You can also check out the Essential JS 2 Pivot Table in other web platforms: Angular, React, Vue, JavaScript, ASP.NET MVC, ASP.NET Core and Blazor.

Now, let me walk you through the significant features that are supported with this OLAP data source.

Connecting to SSAS OLAP cube

All you need to do to connect to the online SSAS OLAP cube is set the following dataSource properties:

  • providerType: set its value to SSAS to name the type of data source with which you are about to connect.
  • URL: accepts the connection string of the server to connect.
  • cube: accepts the valid cube name available on the connected data source.
  • catalog: accepts the valid database available on the connected server.
  • localeIdentifier: Defines the localization. By default, the system language will be used when this is not set explicitly.

Other than these properties, you also need to define properties like rows, columns, values, and filters under the dataSourceSettings to set the appropriate dimensions, hierarchies, measures, etc., on appropriate axes.

let pivotGridObj: PivotView = new PivotView({
    dataSourceSettings: {
        catalog: 'Adventure Works DW 2008 SE',
        cube: 'Adventure Works',
        providerType: 'SSAS',
        url: 'https://bi.syncfusion.com/olap/msmdpump.dll',
        localeIdentifier: 1033,
        rows: [
            { name: '[Customer].[Customer Geography]', caption: 'Customer Geography' },
        ],
        columns: [
            { name: '[Product].[Product Categories]', caption: 'Product Categories' },
            { name: '[Measures]', caption: 'Measures'},
        ],
        values: [
            { name: '[Measures].[Customer Count]', caption: 'Customer Count' },
            { name: '[Measures].[Internet Sales Amount]', caption: 'Internet Sales Amount'}
        ],
        filters: [
            { name: '[Date].[Fiscal]', caption: 'Date Fiscal' },
        ],
    },
});
pivotGridObj.appendTo('#PivotView');

Supported features with OLAP data sources

Let’s dive into the essential feature list of the Pivot Table control connected to the SSAS OLAP data source.

Drill down and up

OLAP cube supports two kinds of hierarchies:

  • Attribute hierarchy—Has only a single level of members.
  • User-defined hierarchy—Supports multiple levels of members.

Using this drill-down and up functionality, you can explore and navigate up to the nth level of parent-child hierarchies. There is a built-in icon placed beside each member of the user-defined hierarchies to identify the state of the member. Simply click on those icons to drill up or down.

NOTE: These icons are not included for attribute hierarchy members.drill down and up in Pivot table

Grouping

The same layout for the grouping bar is retained when the Pivot Table is bound with the relational data source. That way, you can dynamically change the OLAP report during runtime by simply dragging the desired pivot fields between different axes, like columns, rows, values, and filters.Grouping in Pivot table

Field list

As the grouping bar is intended to change the OLAP reports dynamically, you can use the field list option to do the same. An additional quality with this field list option is that it facilitates creating a new OLAP report on the fly. Looking at the field list UI, you can see a tree view that includes the connected cube elements, such as dimensions, hierarchies, levels, measures, and named sets.field list in pivot table

Calculated fields

With the calculated fields option, you can easily create new members and measures by using the existing hierarchies and measures from the connected cube. Just like the field list UI, the calculated field UI has the connected cube elements in a tree view-like structure with drag-and-drop support. You can frame an expression manually under the Expression section or simply drag an element from the tree view section to create the new members or measures.calculated field in pivot table

Sorting

You can sort the hierarchy members of the Pivot Table in ascending, descending, or default order (as such from cube). By default, all the members of pivot table are displayed in ascending order, but it supports sorting both the attribute and user-defined hierarchy members.sorting in pivot table

Filtering

You can set the Pivot Table to display only selected members by using the filtering options. A built-in filter icon will be displayed over the pivot fields on the grouping bar and field list UI. Clicking on it will open the member editor dialog and show the different filtering operations achievable through the UI. There are three kinds of filtering: member filtering, label filtering, and value filtering.filtering in pivot table

Conditional formatting

By using the built-in conditional formatting options of Pivot Table, you can customize the table cell values based on specific conditions. You can also apply multiple conditions at the same time and remove any applied conditions on demand via the UI, as depicted in the following image.conditional formatting in pivot table

Number formatting

Set the desired formats, like currency or percentage, to project the exact measures bound to an OLAP report on a pivot table. This kind of formatting can be set only through code-behind while framing the OLAP report. The formats applied to any measures can be persisted, even if it is removed and added (state persistence).

  let pivotGridObj: PivotView = new PivotView({
      dataSourceSettings: {
          //codes here
          formatSettings: [
              { name: '[Measures].[Internet Sales Amount]', format: 'C0' },
              { name: '[Measures].[Customer Count]', format: 'E' }
          ],           
      },       
  });
  pivotGridObj.appendTo('#PivotView');

Drill through

Drill through is a powerful feature to expose the value of raw items that are used to frame any aggregated value. Say, for example, you want to know the detailed data or an original value of a summary cell. Simply double-click on a cell to drill through and view the detailed report in a new window. Along with raw items, it also holds information like row headers, column headers, and the aggregated value of a clicked cell. In general, one should have the drill-through provision enabled on OLAP cube for retrieving that information.drill through in pivot table

Virtualization

Start to load large amounts of data, up to 1 million records, and view them on demand through virtual scrolling options without any performance degradation. Here, the cell data is set to occupy only the viewport area of the pivot table and to continue to update on every scroll action. Even the other UI operations, such as drill up and down, filtering, sorting, and drag and drop, can work perfectly with any number of records.virtual scrolling in pivot table

Defer layout update

With defer layout update option, you can update the Pivot Table on demand rather than updating it for every UI operation. In such cases, whenever any UI operation is performed through field list, only the report gets updated instead of generating the entire pivot table again and again, thus saving the time.defer update in pivot table

Other common features supported with OLAP data source

Apart from the major supported features discussed so far, let me also list out other features of the Pivot Table that work well when you connect it with an OLAP data source.

FeatureDescription
Frozen headersView the headers even when scrolling. By default, this option is enabled on Pivot Table and can’t be disabled.
Scroll state maintenanceThe scroll position will be maintained even after an update is made on the Pivot Table.
Show or hide totalsShow or hide the subtotals on specific level(s) in a hierarchy that are bound to the OLAP report. Also, show or hide grand totals specifically in row and column axes.
TooltipA pop-up shows while the cursor hovers over the value cells, showing information about the row headers, column headers, measures, and aggregated value with appropriate formatting.
Showing measures on rowsBind measures on a row axis. By default, it will bind on a column axis.
Measures at different positionsDrop measures at the desired position among other hierarchies on the axis.
Filter axisShow the filter status of a hierarchy on the pivot field bound to the filter (slicer) axis.
HyperlinkUsers can set hyperlinks on specific Pivot Table cells based on the cell type and predefined conditions.
ToolbarThis built-in UI is at the top of the Pivot Table, containing frequently used options. For example: report manipulation, table view, chart view with types, show MDX query, exporting, show or hide totals, conditional formatting, and field list.
RTLDisplay the Pivot Table in a right-to-left direction.
ExportingA pivot table bound with an OLAP data source can be exported to PDF, Excel, and CSV formats.
Column resizeYou can resize any column by using the cursor and selecting the border of that column.
Column reorderReorder any column within the Pivot Table.
Cell selectionSelect any cells and retrieve those selected cells’ information, along with their headers.

Summary

To summarize, we have seen how to connect the SSAS OLAP cube data source to the Essential JS 2 Pivot Table component with all its relevant properties. Also, I have listed out the major and common features that should work well when a pivot table is connected to an OLAP data source. Try all these features with our 2019 Volume 3 release.

Try connecting your Pivot Table component to an OLAP data source referring to the shared code example. If you have any questions, please let me know through the comments section below.

Also, explore the other available features of the Pivot Table in our documentation and demos pages. You can download the free 30-day trial to start using the Pivot Table or check it out on GitHub. You can also contact us through our support forum, Direct-Trac or feedback portal. We are always happy to assist you!

Tags:

Share this post:

Comments (1)

[…] How to create Pivot Table with OLAP Data in JavaScript (Ramesh Govindaraj) […]

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed