CalculatedField with count function

2 posts, 0 answers
  1. Sigsa
    Sigsa avatar
    4 posts
    Member since:
    Jun 2009

    Posted 18 Aug 2014 Link to this post

    Hello Everyone,

    I have a problem when I try to extend a custom class from CalculatedField. I need to add a custom formula: the count of fieldA / sum of fieldB, but both always return the sum function, not the count for the first field.

    protected override Telerik.Pivot.Core.Aggregates.AggregateValue CalculateValue(IAggregateValues aggregateValues)
               var aggregateA = aggregateValues.GetAggregateValue(this.fieldA); //I need the count function here
               var aggregateB = aggregateValues.GetAggregateValue(this.fieldB); //and the sum function here

    I will appreciate any sort of help greatly! 

  2. Kalin
    Kalin avatar
    1283 posts

    Posted 20 Aug 2014 Link to this post

    Hi Sigsa,

    By design the PivotGrid uses a SumAggregate when getting the aggregated value of the RequiredField in a custom CalculatedField and you won't be able to override that behavior. However I logged that as a feature request in our Feedback portal, you can track and vote for it on the following link:

    Hope this helps. If you have any other questions or concerns, please let us know.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top