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

Custom Aggregation Function in PivotFieldList

8 Answers 252 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Will
Top achievements
Rank 1
Will asked on 02 Oct 2013, 03:21 PM
Is it possible to create a custom Aggregation Function that will be displayed in the PivotFieldList's list of available aggregators?

Looking at this thread: http://www.telerik.com/community/forums/silverlight/pivotgrid/custom-calculations.aspx I see how it is possible to add a custom Aggregation to a field at start up, but I don't see a way to integrate the custom aggregation function into the PivotFieldList's UI. Is there a way to do this? 

8 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 04 Oct 2013, 01:15 PM
Hello Will,

We have worked really hard in order to give our users the ability to use Calculated Fields. That's why after implementing this functionality we have included it in our internal builds, which you are able to download under your account. I'm sending you a modified version of the mentioned project where calculated fields are used instead of the custom aggregate function. Please note that this example will work only with our latest internal builds - the latest official version doesn't have CaluclatedFields included in it.

By using our Calculated Fields you will see the item in the Field List and also you will reduce the amount of code that you have to write.

Hopefully this makes sense.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
dhairya
Top achievements
Rank 1
answered on 09 Feb 2016, 05:05 PM
I am evaluating PivotGrid for some of the functionality we need it our software. One of the goal for us is to provide users with generic data viewing functionality of their data stored in sql server tables. we bind radpivotgrid to datatable for it that purpose. Now, we would like user to be able to do zero and nonzero weighted averages (we may need to add more functions). Is it possible for us to provide our own aggregation method in RadPivotFieldList and RadPivotGrid? e.g. I would our own aggregated functions to appear in RADPivotFieldList. Adding calculated fields would not help since user should be able specify the aggregation at run time depending on kind of field user is trying to aggregate.
0
Polya
Telerik team
answered on 10 Feb 2016, 01:08 PM
Hello Dhairya,

By using the Index calculation you should achieve the desired. You can apply it from the UI by clicking on the selected aggregate value in the PivotFieldList and selecting the Index item (check the screenshot). You can achieve the same from XAML by using the following snippet:
<pivot:LocalDataSourceProvider.AggregateDescriptions>
    <pivot:PropertyAggregateDescription PropertyName="Net" AggregateFunction="Sum">
        <pivot:PropertyAggregateDescription.TotalFormat>
            <pivot:Index/>
        </pivot:PropertyAggregateDescription.TotalFormat>
    </pivot:PropertyAggregateDescription>
</pivot:LocalDataSourceProvider.AggregateDescriptions>
For more details please check the following article from our online help documentation (look for the Index calculation):
http://docs.telerik.com/devtools/wpf/controls/radpivotgrid/features/localdatasourceprovider/calculations.html#calculations

Regarding the creation of custom aggregate description - we have a great example demonstrating how to achieve that in our QSF demos - http://demos.telerik.com/wpf/ - example "Custom Aggregate Description"

Regards,
Polya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
dhairya
Top achievements
Rank 1
answered on 10 Feb 2016, 07:05 PM

Mine is WinForms app. I tried using the WPF sample and it somewhat worked for SQRT. Hhowever, I don't see how I can make it work for Weighted average calculation. Weighted average requires keeping aggregated value for some extra auxiliary field. For example, you can find weighted average interest rate by unpaid balance. Field names are not hardcoded in my application and really user should be able to specify field value and field weight component.

Also, How does the custom aggregation function appear in PivotFieldList? I see that WPF sample shows SQRT in the available function list. I could not do the same in sample WinForms app i am playing with.

0
dhairya
Top achievements
Rank 1
answered on 10 Feb 2016, 08:38 PM

Add to my last post, I need something similar to what this guy is trying to do here in the link below. My problem is that I can't really add a pre-calculated field for Product Sum in my datasource because i don't know which field user would select at run time.

http://www.telerik.com/forums/weighted-average

 

Any help would be greatly appreciated.

Dhairya

 

0
Polya
Telerik team
answered on 12 Feb 2016, 12:42 PM
Hi Dhairya,

With the current implementation of RadPivotGrid the proposed approach in the thread you mentioned is the only way to achieve the desired.
You would need to create a custom CalculatedField and use the added predefined columns with the product calculations from the database.

Regards,
Polya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Marcus
Top achievements
Rank 1
answered on 26 Feb 2016, 02:09 AM

I find our customers need access to weighted averages in building a pivot table as well (end user needs to control which column is being weighted by).

 

Are there any plans to add necessary infrastructure to allow a weighted average to be included in a way that allows users to select and configure it from the PivotFieldList's dialogs?

0
Polya
Telerik team
answered on 26 Feb 2016, 09:52 AM
Hello Marcus,

I suggest creating a feature request in our Feedback Portal: http://feedback.telerik.com/Project/143 from where you can track the progress of the feature and vote for it.

Regards,
Polya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PivotGrid
Asked by
Will
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
dhairya
Top achievements
Rank 1
Polya
Telerik team
Marcus
Top achievements
Rank 1
Share this question
or