Display Innermost Computations in WPF Pivot Grid

15 Jul 20213 minutes to read

The pivot grid supports displaying the grid with inner most computations alone without displaying the total values by using the InnerMostComputationsOnly property. It can be mentioned in XAML or code-behind.

For XAML, refer to the following code sample.

  • XAML
  • <syncfusion:PivotGridControl Name="pivotGrid" RowPivotsOnly="True">
    
        <syncfusion:PivotGridControl.PivotRows>
            <syncfusion:PivotItem AllowFilter="False" FieldHeader="PID" FieldMappingName="PID" TotalHeader="Total" />
            <syncfusion:PivotItem AllowFilter="False" FieldHeader="Location" FieldMappingName="Location" TotalHeader="Total" />
        </syncfusion:PivotGridControl.PivotRows>
        <syncfusion:PivotGridControl.PivotCalculations>
            <syncfusion:PivotComputationInfo FieldHeader="Color" FieldName="Color" Format="0.0" SummaryType="DoubleTotalSum" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="Class" FieldName="Class" Format="0.0" SummaryType="DoubleTotalSum" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="PID" FieldName="PID" Format="0.0" SummaryType="DoubleTotalSum" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="Units" FieldName="Units" Format="0.0" SummaryType="DoubleTotalSum" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="Retail" FieldName="Retail" Format="0.0" SummaryType="DoubleTotalSum" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="Cost" FieldName="Cost" Format="0.0" SummaryType="DoubleTotalSum" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="TestStr" FieldName="TestStr" Format="0.0" PadString="***" SummaryType="DisplayIfDiscreteValuesEqual" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="TestInt" FieldName="TestInt" Format="0.0" PadString="***" SummaryType="DisplayIfDiscreteValuesEqual" InnerMostComputationsOnly="InnerMostOnly" />
            <syncfusion:PivotComputationInfo FieldHeader="TestDouble" FieldName="TestDouble" Format="0.00" PadString="***" SummaryType="DisplayIfDiscreteValuesEqual" InnerMostComputationsOnly="InnerMostOnly" />
        </syncfusion:PivotGridControl.PivotCalculations>
    
    </syncfusion:PivotGridControl>

    For code-behind, refer to the following code sample.

  • C#
  • public partial class MainWindow: Window {
        public MainWindow() {
            InitializeComponent();
            pivotGrid.Loaded += pivotGrid_Loaded;
        }
    
        void pivotGrid_Loaded(object sender, RoutedEventArgs e) {
            // To define some PivotCalculations 
            // Setting the property value to InnerMost to all the defined PivotCalculations
            for (int i = 0; i < pivotGrid.PivotCalculations.Count; i++)
                pivotGrid.PivotCalculations[i].InnerMostComputationsOnly = Syncfusion.PivotAnalysis.Base.SummaryDisplayLevel.InnerMostOnly;
        }
    }

    Displaying the pivot grid without total values

    NOTE

    You can refer to our WPF Pivot Grid feature tour page for its groundbreaking feature representations. You can also explore our WPF Pivot Grid example to knows how to organizes and summarizes business data and displays the result in a cross-table format.