Custom Aggregation Function in PivotFieldList

9 posts, 0 answers
  1. Will
    Will avatar
    1 posts
    Member since:
    Oct 2013

    Posted 02 Oct 2013 Link to this post

    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? 
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 04 Oct 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. dhairya
    dhairya avatar
    3 posts
    Member since:
    Feb 2016

    Posted 09 Feb in reply to Rosen Vladimirov Link to this post

    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.
  5. Polya
    Admin
    Polya avatar
    199 posts

    Posted 10 Feb Link to this post

    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
  6. dhairya
    dhairya avatar
    3 posts
    Member since:
    Feb 2016

    Posted 10 Feb in reply to Polya Link to this post

    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.

  7. dhairya
    dhairya avatar
    3 posts
    Member since:
    Feb 2016

    Posted 10 Feb in reply to dhairya Link to this post

    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

     

  8. Polya
    Admin
    Polya avatar
    199 posts

    Posted 12 Feb Link to this post

    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
  9. Marcus
    Marcus avatar
    3 posts
    Member since:
    Jan 2015

    Posted 25 Feb Link to this post

    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?

  10. Polya
    Admin
    Polya avatar
    199 posts

    Posted 26 Feb Link to this post

    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
Back to Top
DevCraft banner