I am creating a pivot table using ClosedXML in VB.Net.
Dim ptj = xlWorksheet2.PivotTables.Add("Company", xlWorksheet.Cell(1, 1), xlWorksheet.Range("A1:J"& xlintStartRow - 1))ptj.RowLabels.Add("Region")ptj.RowHeaderCaption = "Region"ptj.Subtotals = XLPivotSubtotals.AtBottomptj.ClassicPivotTableLayout = Trueptj.Layout = XLPivotLayout.Tabularptj.RowLabels.Add("District")ptj.RowHeaderCaption = "District"ptj.Subtotals = XLPivotSubtotals.DoNotShowptj.ClassicPivotTableLayout = Trueptj.Layout = XLPivotLayout.Tabularptj.RowLabels.Add("Territory")ptj.RowHeaderCaption = "Territory"ptj.Subtotals = XLPivotSubtotals.DoNotShowptj.ClassicPivotTableLayout = Trueptj.Layout = XLPivotLayout.Tabularptj.ColumnLabels.Add("YEAR") ptj.ColumnHeaderCaption = "YEAR"ptj.Values.Add("AMT", "SALES").NumberFormat.Format = "#,##0.00"
I want to customize subtotals of each row but my code doesn't work. This is my desired output:
EDIT:THIS IS MY ACTUAL OUTPUT
I think it only accepts one Subtotals
then applied to all rows.
There is also SetSubtotals
function for closedxml pivot table, and tried using the code, but there are no output changes