那个应该是汇总的意思吧。最好给出具体公式,如果说自带的count、sum、avg等汇总公示不能满足需求的话(就没占比的汇总公式嘛),需要自定义汇总公式实现。

解决方案 »

  1.   

    这里有个例子,自己参考下:using DevExpress.XtraPivotGrid;fieldExtendedPrice.Caption = "Percentage of Orders over $500";
    // Enable a custom summary calculation for the Extended Price field.
    fieldExtendedPrice.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Custom;
    // Specify the settings used to format values.
    fieldExtendedPrice.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
    fieldExtendedPrice.CellFormat.FormatString = "p";int minSum = 500;private void pivotGridControl1_CustomSummary(object sender, 
      PivotGridCustomSummaryEventArgs e) {
       if(e.DataField != fieldExtendedPrice) return;
       // A variable which counts the number of orders whose sum exceeds $500.
       int order500Count = 0;
       // Get the record set corresponding to the current cell.
       PivotDrillDownDataSource ds = e.CreateDrillDownDataSource();
       // Iterate through the records and count the orders.
       for(int i = 0; i < ds.RowCount; i++) {
          PivotDrillDownDataRow row = ds[i];
          // Get the order's total sum.
          decimal orderSum = (decimal)row[fieldExtendedPrice];
          if(orderSum >= minSum) order500Count ++;
       }
       // Calculate the percentage.
       if(ds.RowCount > 0) {
          e.CustomValue = (decimal)order500Count/ds.RowCount;
       }
    }
      

  2.   

    那个例子看来吗?通过自定义CustomSummary事件就可以实现你那个效果,顺便给你看下效果图: