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.
Unfortunately, activation email could not send to your email. Please try again.

Adding Calculation Column

Thread ID:

Created:

Updated:

Platform:

Replies:

124252 May 26,2016 03:42 PM May 30,2016 12:14 AM Windows Forms 3
loading
Tags: PivotGridControl
Chris Bishop
Asked On May 26, 2016 03:42 PM

How to I add a calculation column to a pivot grid.

Col1 - Col2

Adhikesevan Kothandaraman [Syncfusion]
Replied On May 27, 2016 09:17 AM

Hi Chris, 

To add PivotCalculations with the subtraction of two columns, you can use the Formula and CalculationType properties of the PivotComputationInfo. You can set the formula for compute the value of the particular column using the Formula property. Please refer to the following Code snippet,  

Code Snippet: 
// Adding PivotCalculations to the Control 
this.pivotGridControl1.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Amount", Format = "#,##0", SummaryType = SummaryType.DoubleTotalSum }); 
 
this.pivotGridControl1.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Quantity", Format = "#,##0" }); 
 
this.pivotGridControl1.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Sub", Format = "#,##0", CalculationType = CalculationType.Formula, Formula = "[Amount] - [Quantity]" }); 
 
 
Sample Link: 
  

 


Regards, 
Adhi 
 


Chris Bishop
Replied On May 27, 2016 10:04 AM

Thank you so much!

That worked.

Adhikesevan Kothandaraman [Syncfusion]
Replied On May 30, 2016 12:14 AM

Hi Chris, 

Thanks for your update. 

We are glad to know that your query has been solved. Please let us know if you need any further assistance. 

Regards, 
Adhi 


CONFIRMATION

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.

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.

;