When using xamPivotGrid with a FlatData source, is it possible to customize the aggregation function to be used?
For example we need an employee efficiency data to be shown in xamPivotGrid, with three Measures:
'Productive Hours' (int value), 'Total Hours' (int value) and '% Efficiency' (decimal %).
where '% Efficiency' = 'Productive Hours' * 100 / 'Total Hours'.
By default the '% Efficiency' measure is also just adding up all the individual percentages, rather than applying the same formula on the aggregates. And so after doing much research, I ran into this post and I followed the instruction to succesfully achieve the above functionality using Custom Aggregator. However this may not be a viable solution for my application since the Dynamic Measures would be based on formulas coming in from the database via WCF service. Hence I can't really create a static Custom Aggrgegator.
Also I see that you can specify AggregatorType = Calculated when defining DimensionMetadata. Can you please its usage and if there is a way to specify formula based on other Measures.
Thanks.
Hi,
I've contacted development concerning your questions and I'll get back to you shortly with their response.
This thread may be of interest:
http://community.infragistics.com/forums/p/57556/293662.aspx#293662
I believe that thread and sample are similar to the one that epsiwebdev mentioned.
http://news.infragistics.com/forums/t/56695.aspx
Plamen is discussing a Custom Measure Aggregator there also and provides code as well.
I think this question is whether there is an alternate way to achieve the same functionality by using formulas supplied by a database.
I haven’t heard back definitively from our development staff but will update you as soon as I do.
Your question doesn’t appear to be an issue of the pivot grid. It’s more about implementing a functionality. The suggested is to use this free library http://flee.codeplex.com/ to accomplish what you need.
HI,
I’m just following up on this forum post.
Do you need further assistance regarding this issue?
If so, please feel free to contact me.
Not sure yet -- haven't had a chance to try out this solution... Will update this forum once I have.
That's fine. Let me know if you have any questions.
Hello Alex,
The aggregator that should be used is resolved in that order:
1. If there is set DimensionMetadata.Aggregator that aggregator will be used.
2. If DimensionMetadata.Aggregator is null we resolve the aggregator based on DimensionMetadata.AggregatorType and DimensionMetadata.SourcePropertyName. DimensionMetadata.SourcePropertyName is mandatory when dimension metadata describes a measure no matter what DimensionsGenerationMode is.
Keep in mind that currently we support and can resolve only these aggregator types: Sum, Mix, Max, Count and Average. Any custom implementation supposes that you have to set DimensionMetadata.Aggregator explicitly.
Regards.
Plamen.
I have a question that I think is related to the discussed topic here.
In fact I need to create kind of derived column.
For that I am creating new DimensionMetadata and adding it dynamically dimensions to my cube settings. I need to start with the dimensions that would use source property of String type.
I have defined custom aggregator
public class CustomStringDimensionAggregator : Aggregator<String>
and overriden its two Evaluate methods to return dummy string value. The thing is they are never being called at the run time. I have tried specify Aggregator Type as Unknown or None - same result.
My question - is it possible to create dynamically dimensions at the run time and difine their values ? Should I use Custom or Predefined Aggregators for this ?
Thanks a lot,
Alex
I hadn’t heard back from you and I am checking to see if you had any further questions.
Please let me know if there is anything I can help with.
The code that I see in your sample is building a class of string values. I didn’t see any numeric items in your class. I modified your sample and adding a third property that is a decimal and worked it in to generate a numeric value in your list data and a dimension of the pivotgrid and was able to see it added as a measure to your pivotgrid.
I also thought your question was about customized aggregators that would deal with percentages differently, for instance, instead of adding them up as a total. In the link I mentioned Plamen added a CustomAggregator code in the attachment which you might want to look at.
You also might want to review the feature browser sample for the xamPivotGrid on the Visual tab in the Display section called FlatData aggregators. It demonstrates both standard and custom aggregators.
Let me know if you have further questions.
I do have one question, actually. While I was able to create dynamic properties (as shown in the attached project), I'm not sure how to relate them to one another to fill in the grid. Right now, when I add each column to the grid, I get horizontal and vertical data, but not sure how to "fill in" the measures on the inside of the grid, if that makes sense.