Вам необходимо добавить этот код в событие OnCalculateCustomSummary поля:
procedure TMyForm.cxDBPivotGrid1Field2CalculateCustomSummary(Sender: TcxPivotGridField; ASummary: TcxPivotGridCrossCellSummary);
var
AColumn: TcxPivotGridGroupItem;
APrevCrossCell: TcxPivotGridCrossCell;
APrevCrossCellSummary: TcxPivotGridCrossCellSummary;
begin
inherited;
AColumn := ASummary.Owner.Column;
if (AColumn.Level = -1) then
// column grand totals
ASummary.Custom := ASummary.Sum
else begin
// all cells, except for column grand totals
// getting a custom summary calculated for the previous grouping value
if AColumn.PrevSibling <> nil then begin
APrevCrossCell := AColumn.PrevSibling.GetCellByCrossItem(ASummary.Owner.Row);
APrevCrossCellSummary := APrevCrossCell.SummaryCells[Sender.SummaryIndex];
ASummary.Custom := VarToDouble(APrevCrossCellSummary.Custom) + VarToDouble(ASummary.Sum);
end
else
ASummary.Custom := ASummary.Sum;
end;
end;
И это в событии OnGetDisplayText поля:
procedure TForm1.cxDBPivotGrid1Field2GetDisplayText(Sender: TcxPivotGridField; ACell: TcxPivotGridDataCellViewInfo; var AText: string);
begin
inherited;
AText := VarToStr(ACell.CellSummary.Custom)
end;
Извлечено из: http://www.devexpress.com/Support/Center/p/Q90021.aspx