Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
0
Multiple aggregators on same measure in OlapFlatDataSource
posted

Hi,

I am working with igPivotGrid and I'm looking for a good solution to allow various aggregations on the same measure. To give an example, let's say I have a measure 'Duration' which is time in seconds and I want to allow user to perform several operations on it like sum, count, average etc. To be more specific,  I want user to select the aggregation he would like to perform, which means that at a time only one aggregation will be applied but user can change the aggregation and the grid will be created again. How can I do something like this?

If we take the code, I want something like this

measuresDimension: {
caption: "Measures",
measures: [ 
{
caption: "Duration", name: "Duration",

aggregator: [ $.ig.OlapUtilities.prototype.sumAggregator('Duration') ,  $.ig.OlapUtilities.prototype.average('Duration'), 

$.ig.OlapUtilities.prototype.count('Duration') ]
}]
}

Here, instead of one function in the aggregator I have added an array of all functions I need. Note that, this is hypothetical and is just to give an idea of what I want.

Another approach for this could obviously be like this:

measuresDimension: {
caption: "Measures",
measures: [ 
{
caption: "Sum(Duration)", name: "Duration Sum",

aggregator: $.ig.OlapUtilities.prototype.sumAggregator('Duration') 
},

{
caption: "Average(Duration)", name: "Duration Average",

aggregator: $.ig.OlapUtilities.prototype.average('Duration') 
},

{
caption: "Count(Duration)", name: "Duration Count",

aggregator: $.ig.OlapUtilities.prototype.count('Duration') 
}]
}

But here we are defining 3 measures on the same attribute and it just doesn't look right. I was thinking that there might be a more elegant way for this.

Secondly, I could only find  $.ig.OlapUtilities.prototype.sumAggregator function in the API. Are there any other functions for average, count etc. and if not how can I define a function myself.

Thanks in advance.