diff --git a/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs b/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs index b7249d9..a7542ba 100644 --- a/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs +++ b/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs @@ -33,7 +33,7 @@ public IXLPivotValue Add(String sourceName, String customName) { var pivotValue = new XLPivotValue(sourceName) { CustomName = customName }; - _pivotValues.Add(sourceName, pivotValue); + _pivotValues.Add(customName, pivotValue); if (_pivotValues.Count > 1 && !this._pivotTable.ColumnLabels.Any(cl => cl.SourceName == XLConstants.PivotTableValuesSentinalLabel) && !this._pivotTable.RowLabels.Any(rl => rl.SourceName == XLConstants.PivotTableValuesSentinalLabel)) _pivotTable.ColumnLabels.Add(XLConstants.PivotTableValuesSentinalLabel);