In my Pivot table, I have a data field which I want to be summarized as sum. I tried changing the subtotalfunction property to sum, but it is creating a new value called "sum of Amount" along with the original Amount value in the pivot table. But I want to change the original Amount value aggregation to sum instead of count and I don't want to create a new one.
Excel.PivotField valueField = pivotTable.PivotFields("Amount");
valueField.Orientation = Excel.XlPivotFieldOrientation.xlDataField;
valueField.Function = Excel.XlConsolidationFunction.xlSum;
Can someone give me an example of how I can do this?
I'm using Microsoft Interop Excel.
Thanks so much :)