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
How to Set AggregateType to Count for xamPivotGrid Measure

I'm developing a WPF app where I load a flat data source from an Excel spreadsheet file into an xamPivotGrid Control.  I have been able to programmatically add filters, rows, columns and measures, but the default AggregateType for my measure is "sum" and I want "count".  I have a button in my GUI and in the event handler for the button I have the following code snippet:

IMeasureViewModel mvm = FindMeasureViewModel("Serial_Number");

if (mvm != null)
    mvm.Measure.AggregatorType =

The FindMeasureViewModel method looks like this:

// Searches the data source looking for the specified measure
private IMeasureViewModel FindMeasureViewModel(string measureName)
if (fDataSource == null) return null;

for (int i = 0; i < fDataSource.Measures.Count; i++)
if (((IMeasureViewModel)fDataSource.Measures[i]).Caption == measureName)
return fDataSource.Measures[i] as IMeasureViewModel;


return null;

The problem I'm having is that the above code appears to have no effect on the measure once the cube is built and the data source is attached to the pivot grid control.  In other words, the pivot grid is still displaying the measure as a "sum" instead of the desired "count".  What am I doing wrong?  Do I need to tell the grid to refresh somehow or would it normally do that on its own?

Parents Reply Children
No Data