Hi,
The requirement that I have is to create a custom calculated aggregator in order to get the Percent of total of a Measure, I have tried to use PercentOfTotalAggregator (see link) unsuccessfully!
I am currently using version 11.1
I would appreciate about example code.
Thanks!
Hello,
This aggregator implementation refers to functionality which is not supported yet and is reserved for future uses.
Plamen.
Hello again,
Actually after I answered you I’ve looked again at your case and there is a way you can use this aggregator with some limitations:
1. This aggregator implements ICompoundAggregator and is based on another aggregator:
<!—Measure over simple aggregator-->
<olap:DimensionMetadata SourcePropertyName="Cost"
DisplayName="Model Price"
GroupName="Model Price"
DimensionType="Measure" DisplayFormat="{}{0:C3}">
<olap:DimensionMetadata.Aggregator>
<olap:DoubleSumAggregator Identity="DoubleOfCost"/>
</olap:DimensionMetadata.Aggregator>
</olap:DimensionMetadata>
<!—Measure over compound aggregator-->
<olap:DimensionMetadata DisplayName="Model Price (%)" GroupName="Model Price"
DimensionType="Measure" DisplayFormat="{}{0:0.##} %">
<olap:PercentOfTotalAggregator>
<olap:PercentOfTotalAggregator.Parts>
</olap:PercentOfTotalAggregator.Parts>
</olap:PercentOfTotalAggregator>
When you add the measure based on the compound aggregator to measures collection its base measure have to be already present to the measures. The compound aggregators connects to its parts through their Identity.
2. In order these measures to appear in metadata tree you have to enable mixed mode for dimension generation:
<olap:FlatDataSource x:Key="flatDataSource" ParentInFrontForColumns="True"
MeasureListLocation="Columns"
DimensionsGenerationMode="Mixed"
...
3. Because we have set MeasureListLocation="Columns" all other hierarchies should be placed in the rows area
Have a look at the snapshot below. Also in order to calculate the percentages properly before add the compound measure you need to have already expanded the Date hierarchy.
Please note that in the future we can change the way this functionality works.
Regards.Plamen.