This is a migrated thread and some comments may be shown as answers.

Wierd Total Behaviour for Calculated Field

1 Answer 74 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Neil N
Top achievements
Rank 1
Iron
Veteran
Iron
Neil N asked on 17 Dec 2014, 11:41 PM
2014Q3 controls.

Field definitions

<Fields>
    <telerik:PivotGridRowField Caption="Company Name" DataField="sEntityName"
        UniqueName="sEntityName">
    </telerik:PivotGridRowField>
    <telerik:PivotGridRowField Caption="Material" DataField="Material"
        UniqueName="Material">
    </telerik:PivotGridRowField>
    <telerik:PivotGridColumnField Caption="Year" DataField="SubmissionYear"
        UniqueName="SubmissionYear">
    </telerik:PivotGridColumnField>
    <telerik:PivotGridColumnField Caption="Period" DataField="Period"
        UniqueName="Period">
    </telerik:PivotGridColumnField>
    <telerik:PivotGridAggregateField Caption="KG" DataField="KG"
        GrandTotalAggregateFormatString="{0:###,###.00}" UniqueName="KG" CellStyle-CssClass="ptRJ" TotalFormatString="{0:###,###.00}" DataFormatString="{0:###,###.00}">
    </telerik:PivotGridAggregateField>
    <telerik:PivotGridAggregateField DataField="% of Total" CalculationDataFields="KG,TotalKG" CalculationExpression="{0}/{1}" DataFormatString="{0:p}">
    </telerik:PivotGridAggregateField>
</Fields>

KG = amount of a certain material for one company
TotalKG = amount of a certain material for all companies

The % of Total column is working properly for detail rows and subtotal rows.  However for the grand total row I get 6.25%, which is 100 / 16 (the number of companies) / 100.  I am expecting to see 100% as the Grand Total of Sum of KG equals the total of all materials for all companies. Bug or something else?

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 22 Dec 2014, 12:43 PM
Hi Neil,

Actually, the behavior that you are describing is made that way by design and the same CalculationExpression will be applied to the total fields as well. This means that in your Grand Total you will have the total of all KG values divided by the total of all TotalKG. The same behavior could be observed in the following online demo:
Due to the way that RadPivotGrid is implemented, there is no way for chancing that behavior for the PivotGridAggregateField and CalculationExpression and it will be applied to all fields in the same manner.


Best Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PivotGrid
Asked by
Neil N
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Konstantin Dikov
Telerik team
Share this question
or