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

CalculatedField with count function

1 Answer 110 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Sigsa
Top achievements
Rank 1
Sigsa asked on 18 Aug 2014, 08:48 PM
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! 

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 20 Aug 2014, 03:21 PM
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:
http://feedback.telerik.com/Project/143/Feedback/Details/136167-provide-an-option-to-change-the-aggregate-function-of-the-requiredfield-in-a-cust

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

Regards,
Kalin
Telerik
 
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.
 
Tags
PivotGrid
Asked by
Sigsa
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or