I tried to add a formula but I really need a calculated field.
I can manually add a calculated field to do what i want (pivotfield1/(pivotfield1 + pivotfield2)).
I went to add this to my pivot table by pt.CalculatedFields.Add('Name', "'pviotfield1'/('pivotfield1' + 'pivotfield2')"); but i get an error saying object reference not set to an object stacktrace: at Spire.Xls.Core.Spreadsheet.PivotTables.XlsPivotTable.8()
any ideas how to add a calculated field? There is hardly any documentation on pivot tables