We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Pivot Table: Show Values As % of Row Total

Thread ID:





140873 Nov 12,2018 05:03 PM UTC Nov 13,2018 03:52 PM UTC ASP.NET Web Forms (Classic) 2
Tags: XlsIO
Steve Good
Asked On November 12, 2018 05:03 PM UTC

Hello ~

In Excel on a Pivot Table, when you define something in the Values section, you can go to the Value Field Settings, go to the Show Values As tab and choose "Show values as" to be "% of Row Total".  Can that be replicated using xlsio?  Screen print below of the dialog box I'm talking about.


Prakash Kumar D [Syncfusion]
Replied On November 13, 2018 10:12 AM UTC

Hi Steve, 
Thank you for contacting Syncfusion support. 
Your requirement can be achieved by using IPivotDataField.ShowDataAs  property. Please refer the code snippet below. 
Code snippet: 
IPivotCache cache = workbook.PivotCaches.Add(pivotSheet["A1:D40"]); 
IPivotTable pivotTable = pivotSheet.PivotTables.Add("PivotTable1", pivotSheet["A50"], cache); 
pivotTable.Fields[0].Axis = PivotAxisTypes.Page; 
pivotTable.Fields[2].Axis = PivotAxisTypes.Row; 
pivotTable.Fields[1].Axis = PivotAxisTypes.Row; 
pivotTable.Fields[3].Axis = PivotAxisTypes.Column; 
IPivotField dataField = pivotSheet.PivotTables[0].Fields[3]; 
pivotTable.DataFields.Add(dataField, "Sum of Units", PivotSubtotalTypes.Sum); 
//Set show data  
pivotTable.DataFields[0].ShowDataAs = PivotFieldDataFormat.PercentageOfRow; 
Please let us know if you need further assistance on this. 
Prakash Kumar 

Steve Good
Replied On November 13, 2018 03:52 PM UTC

Perfect ~ thank you!


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon