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.

Percentage column

Thread ID:

Created:

Updated:

Platform:

Replies:

122102 Feb 17,2016 05:07 AM Feb 18,2016 05:21 AM WPF 3
loading
Tags: PivotGridControl
Juraj Tomana
Asked On February 17, 2016 05:07 AM

Hi.

Please help me with following problem...


I have following pivot-columns:

[A] [B]      [C]


[A] and [B]  .. are some double values
[C] is percentage (([A] - [B])/[A])


Definition in xaml:
   <syncfusion:PivotGridControl.AllowedFields>
          <syncfusion:FieldInfo Name="C" Expression="([A] - [B]) / [A]" FieldType="Expression" />
        </syncfusion:PivotGridControl.AllowedFields>
        
        <syncfusion:PivotGridControl.PivotCalculations>
          <syncfusion:PivotComputationInfo FieldHeader="A" FieldName="A" SummaryType="DecimalTotalSum"/>
          <syncfusion:PivotComputationInfo FieldHeader="B" FieldName="B" SummaryType="DecimalTotalSum"/>

          <syncfusion:PivotComputationInfo FieldHeader="C" 
                                           FieldName="C"
                                           SummaryType="DecimalTotalSum"
                                           Format="P"/>
        </syncfusion:PivotGridControl.PivotCalculations>




Problem is, that the total value of [C] is summary of its pivot values, not the value ([TOTAL_A]-[TOTAL_B])/[TOTAL_A].


Thanks.
Regards,
Juraj


Saranya Chandrasekaran [Syncfusion]
Replied On February 18, 2016 01:08 AM

Hi Juraj,

 

We have analyzed the reported problem and it can be resolved by using the “CalculationType” property of PivotComputationInfo as “Formula”.

 

Please refer to the following code example.

 

<syncfusion:PivotGridControl.PivotCalculations>      

      <syncfusion:PivotComputationInfo CalculationName = "Total" Description = "Summation of values" FieldName = "Amount" Format = "C" SummaryType="DoubleTotalSum"/>

      <syncfusion:PivotComputationInfo CalculationName = "Total" Description = "Summation of values" FieldName = "Quantity" Format = "#,##0"/>

      <syncfusion:PivotComputationInfo CalculationName = "Total" Description = "Summation of values" FieldName = "UnitPrice" CalculationType="Formula" Formula="[Amount] / [Quantity]" Format = "C" SummaryType="DoubleTotalSum" AllowRunTimeGroupByField="False"/>

</syncfusion:PivotGridControl.PivotCalculations>

 

Regards,

Saranya C.

 


Juraj Tomana
Replied On February 18, 2016 01:57 AM

Hi.

When I try to do it this way with Formula, some exceptions are thrown. Could you please modify my sample from the attachement?

Thanks.
Regards,
Juraj



Attachment: CS_c0952c47.zip

Saranya Chandrasekaran [Syncfusion]
Replied On February 18, 2016 05:21 AM

Hi Juraj,

We have modified your sample. Please refer to the appropriate sample below.

Sample  Link:
122102


NOTE: The expression given in the “Formula” property must have the “FieldName” of “PivotCalculations”.

Regards,
Saranya C.

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.

;