Percentage column

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


3 Replies

SC Saranya Chandrasekaran Syncfusion Team February 18, 2016 06:08 AM UTC

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.

 



JT Juraj Tomana February 18, 2016 06:57 AM UTC

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


SC Saranya Chandrasekaran Syncfusion Team February 18, 2016 10:21 AM UTC

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.

Loader.
Up arrow icon