How to: Hide Row Totals

This example demonstrates how to use the CustomCellValue event to hide field's row totals and grand totals. When field values are collapsed, the totals remain hidden.

hide-totals-customcellvalue

NOTE

The complete sample project How to Handle the CustomValueCell Event to Hide Row Totals is available in the DevExpress Examples repository.

private void pivotGridControl1_CustomCellValue(object sender, PivotCellValueEventArgs e)
{
    if (e.DataField == fieldLowLevel)
    {
        PivotGridField lastLevelField = pivotGridControl1.GetFieldsByArea(PivotArea.RowArea).Last();
        if(e.RowValueType == PivotGridValueType.Total 
            || e.RowValueType == PivotGridValueType.GrandTotal 
            || e.RowField != lastLevelField)
            e.Value = null;
    } 
}