Get Free Trial
List of all demos

React Pivot Table for MS Analysis Services

Flexmonster Pivot Table & Charts provides an impeccable connection to Microsoft Analysis Services cubes.


    import React, { Component } from "react";
    import * as FlexmonsterReact from "react-flexmonster";
    
    class PivotTableDemo extends Component {
      render() {
        return (
          <>
            <div className="App">
              <FlexmonsterReact.Pivot
                ref="pivot"
                componentFolder="https://cdn.flexmonster.com/"
                toolbar={true}
                beforetoolbarcreated={(toolbar) => {
                  toolbar.showShareReportTab = true;
                }}
                shareReportConnection={{
                  url: "https://olap.flexmonster.com:9500",
                }}
                width="100%"
                height={600}
                report={{
                  dataSource: {
                    type: "microsoft analysis services",
                    proxyUrl: "https://olap.flexmonster.com:8085/",
                    catalog: "Adventure Works DW Standard Edition",
                    cube: "Adventure Works",
                    binary: true,
                  },
                  slice: {
                    rows: [
                      {
                        uniqueName: "[Product].[Product Categories]",
                      },
                    ],
                    columns: [
                      {
                        uniqueName: "[Customer].[Country]",
                      },
                      {
                        uniqueName: "[Date].[Month of Year]",
                        caption: "Month",
                      },
                      {
                        uniqueName: "[Measures]",
                      },
                    ],
                    measures: [
                      {
                        uniqueName: "[Measures].[Internet Total Product Cost]",
                        format: "-9cs4ysg4l9dqe",
                      },
                      {
                        uniqueName: "[Measures].[Internet Average Sales Amount]",
                        active: false,
                        format: "-m7dk25oo2smw7",
                      },
                      {
                        uniqueName: "[Measures].[Gross Profit]",
                        active: false,
                        format: "-1k8oq43hkyu4b",
                      },
                    ],
                    drills: {
                      rows: [
                        {
                          tuple: ["[Product].[Product Categories].[Category].&[4]"],
                        },
                        {
                          tuple: [
                            "[Product].[Product Categories].[Subcategory].&[28]",
                          ],
                        },
                        {
                          tuple: [
                            "[Product].[Product Categories].[Subcategory].&[25]",
                          ],
                        },
                      ],
                    },
                    memberProperties: [
                      {
                        levelName: "[Product].[Product Categories].[Product]",
                        properties: ["List Price", "Start Date"],
                      },
                    ],
                  },
                  options: {
                    showMemberProperties: true,
                  },
                  formats: [
                    {
                      name: "-m7dk25oo2smw7",
                      decimalPlaces: 0,
                    },
                    {
                      name: "-1k8oq43hkyu4b",
                      decimalPlaces: 0,
                    },
                    {
                      name: "-9cs4ysg4l9dqe",
                      decimalPlaces: 2,
                      currencySymbol: " $",
                      positiveCurrencyFormat: "1$",
                      negativeCurrencyFormat: "-1$",
                    },
                  ],
                }}
                customizeCell={this.customizeCellFunction}
              />
            </div>
          </>
        );
      }
      customizeCellFunction = (cell, data) => {
        if (data.level != undefined) {
          cell.addClass("fm-level-" + data.level);
        }
      };
    }
    
    export default PivotTableDemo;
    
    #fm-pivot-view .fm-grid-view div.fm-level-0.fm-cell,
    #fm-pivot-view .fm-grid-view div.fm-level-0.fm-cell.fm-total {
      background-color: #a7d6ae;
    }
    
    #fm-pivot-view .fm-grid-view div.fm-level-1.fm-cell,
    #fm-pivot-view .fm-grid-view div.fm-level-1.fm-cell.fm-header,
    #fm-pivot-view .fm-grid-view div.fm-level-1.fm-cell.fm-total {
      background-color: #bee8c5;
    }
    
    #fm-pivot-view .fm-grid-view div.fm-level-2.fm-cell,
    #fm-pivot-view .fm-grid-view div.fm-level-2.fm-cell.fm-header,
    #fm-pivot-view .fm-grid-view div.fm-level-2.fm-cell.fm-total {
      background-color: #e1f7e4;
    }
    
    #fm-pivot-view .fm-grid-layout .fm-grand-total {
      background-color: #f5f5f5 !important;
    }
    
    #fm-pivot-view .fm-grid-layout span.fm-hierarchy-link {
      color: #0d0d0d !important;
    }
    

    Our React pivot grid allows you to connect to OLAP cubes using the XMLA protocol or a much faster approach via the Flexmonster Accelerator — a server-side proxy. Flexmonster works efficiently both with SSAS tabular and multidimensional models.

    Refer to the Connecting to Microsoft Analysis Services guide to learn all the details needed to start with Microsoft Analysis Services and React pivot table.

    To learn how to connect to Microsoft Analysis Services or Azure Analysis Services with the highest performance, get straight to the Getting started with Flexmonster Accelerator guide.