Wierd Total Behaviour for Calculated Field

2 posts, 1 answers
  1. Neil N
    Neil N avatar
    89 posts
    Member since:
    Aug 2012

    Posted 17 Dec 2014 Link to this post

    2014Q3 controls.

    Field definitions

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

    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?
  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    2386 posts

    Posted 22 Dec 2014 Link to this post

    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

    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.

Back to Top