I am running the query below which constructs a list of devices while combining some values into new ones. Whenever I include multiple Aggregate() calls, any measures that use an aggregator other than SUM return empty values (for example [Measures].[#performance.uniquePurchases]).


WITH
MEMBER [SEWDeviceType].[#device.desktop] AS Aggregate({ [SEWDeviceType].[SEWDeviceType].[WEBDESK], [SEWDeviceType].[SEWDeviceType].[DEVMAIL] })
MEMBER [SEWDeviceType].[#device.other] AS Aggregate({ [SEWDeviceType].[SEWDeviceType].[#null], [SEWDeviceType].[SEWDeviceType].[OTHER] })
SET [Devices] AS {
[SEWDeviceType].[#device.desktop],
[SEWDeviceType].[SEWDeviceType].[#null],
[SEWDeviceType].[#device.other]
}


SET [CJ_SET_WITH_SLICER] AS CROSSJOIN(
[Devices],
NONEMPTYCROSSJOIN(
{[Time].[2016].[4].[11].[2016-11-17]:[Time].[2017].[1].[2].[2017-02-17]},
{([Currency].[EUR])}
)
)
SET [CJ_SLICER] AS GENERATE([CJ_SET_WITH_SLICER], {([Currency].CURRENTMEMBER, [MarketingEventWorkgroup].CURRENTMEMBER, [Time].CURRENTMEMBER)})
SET [CJ_ROW_AXIS] AS GENERATE([CJ_SET_WITH_SLICER], {[SEWDeviceType].[SEWDeviceType].CURRENTMEMBER})


MEMBER [Measures].[#performance.productRevenue] AS SUM([SEWEventType].[buy], [Measures].[MarketingEventsOrderTotalSum])
MEMBER [Measures].[#performance.uniquePurchases] AS SUM([SEWEventType].[buy], [Measures].[MarketingEventsTotalDistinctCount])
MEMBER [Measures].[#performance.averagePrice] AS SUM([SEWEventType].[buy], [Measures].[MarketingEventsOrderTotalAvg])
SELECT
{
[Measures].[#performance.productRevenue],
[Measures].[#performance.uniquePurchases],
[Measures].[#performance.averagePrice]
} ON COLUMNS,
[CJ_ROW_AXIS] ON ROWS
FROM
[Reporting]
WHERE
[CJ_SLICER]




Here is the result:

[Measures].[#performance.productRevenue] [Measures].[#performance.uniquePurchases] [Measures].[#performance.averagePrice]
[SEWDeviceType].[#device.desktop]
[SEWDeviceType].[#null] 1,656.00 1 23.00
[SEWDeviceType].[#device.other] 1,656.00



You can see that for SEWDeviceType.#null I get a result in uniquePurchases and averagePrice but not for SEWDeviceType.#device.other. this happens only when I am not using a Sum measure and also only when in my list of Devices I have at least 2 Aggregate commands. It might be a bug in Mondrian but when I comment out [SEWDeviceType].[#device.desktop] then the query returns the right thing:


[Measures].[#performance.productRevenue] [Measures].[#performance.uniquePurchases] [Measures].[#performance.averagePrice]
[SEWDeviceType].[#null] 1,656.00 1 23.00
[SEWDeviceType].[#device.other] 1,656.00 1 23.00


I would really appreciate if anyone could point me in the right direction of how to either do the query correctly or work around this issue.