Hide totals for a specific hierarchy in the classic (tabular) view

Configuring the slice

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div>
  <h2>
    How to hide totals for a specific hierarchy in the classic (tabular) view
  </h2>
  <p>
    You can hide subtotals for a hierarchy by setting its
    <code>showTotals</code> property to <code>false</code> in the slice.
    Besides, you can manage totals using the context menu: right-click the
    hierarchy header and select <strong>Hide/Show subtotals</strong>.
  </p>
  <p>
    In this example, totals are hidden for the <code>Country</code> hierarchy
    and shown for the <code>Color</code> hierarchy.
  </p>
  <p>
    <a href="https://www.flexmonster.com/doc/slice/" target="_blank"
    >Visit our docs to learn more about configuring the slice</a>.
  </p>
</div>

<div id="pivot-container"></div>

CSS

@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      filename: "data/data.json"
    },
    slice: {
      rows: [
        {
          uniqueName: "Country",
          showTotals: false
        }, 
        {
          uniqueName: "Color",
          filter: {
          	members: ["blue", "green"] 
          }
        },
        {
        	uniqueName: "Category"
        }
      ],
      columns: [
      	{ uniqueName: "[Measures]"}
      ],
      measures: [
      	{ 
        	uniqueName: "Price",
          format: "currency"
        },
        { 
        	uniqueName: "Discount",
          format: "currency"
        }
      ],
      expands: {
        expandAll: true
      }
    },
    options: {
      grid: {
        type: "classic"
      }
    },
    formats: [
    	{
      	name: "currency",
        decimalPlaces: 2,
        currencySymbol: "$"
      }
    ]
  }
});