Hi, I encountered a strange behaviour of Analysis Services in server version 10.0.5500.0 as well as 11.0.3000.0.
Context: I have defined a cube with a base measure like this:
AggregateFunction: Min; DataType: Double; Visible: False; Name: Hat Daten; Source ExistingFactdata.hatDaten (Double)
As you can see, the Aggregate Function is Min.
The fact table contains in the hatDaten Column only 0 or 1 values, the idea is to return zero as soon as the data selection contains a category that is linked to a zero value in the ExistingFactdata table.
When I now run the following Query, I am getting 1's for each selected category:
WITH
SET [adhoc] AS 'UNION(DESCENDANTS([Gebiete].[Hierarchie].[Bezirk].[010],[Gebiete].[Hierarchie].[Landkreis]),DESCENDANTS([Gebiete].[Hierarchie].[Bundesland].[10],[Gebiete].[Hierarchie].[Landkreis]))'
SELECT { [Zeit].[Hierarchie].[Jahr].[2008]} ON 0, [adhoc] ON 1
FROM [Fallzahl Inzidenz]
WHERE ([Hat Daten])
when I now change this query to the following I would expect 1 as the result
WITH
SET [adhoc] AS 'UNION(DESCENDANTS([Gebiete].[Hierarchie].[Bezirk].[010],[Gebiete].[Hierarchie].[Landkreis]),DESCENDANTS([Gebiete].[Hierarchie].[Bundesland].[10],[Gebiete].[Hierarchie].[Landkreis]))'
MEMBER [Gebiete].[Hierarchie].[adhoc] AS 'Aggregate([adhoc])'
SELECT { [Zeit].[Hierarchie].[Jahr].[2008]} ON 0
FROM [Fallzahl Inzidenz]
WHERE ([Gebiete].[Hierarchie].[adhoc],[Hat Daten])
But instead I am getting 0
When I change the Aggregate function to explicitly calling Min in the [Gebiete].[Hierarchie].[adhoc] Member I get the desired result of 1
WITH
SET [adhoc] AS 'UNION(DESCENDANTS([Gebiete].[Hierarchie].[Bezirk].[010],[Gebiete].[Hierarchie].[Landkreis]),DESCENDANTS([Gebiete].[Hierarchie].[Bundesland].[10],[Gebiete].[Hierarchie].[Landkreis]))'
MEMBER [Gebiete].[Hierarchie].[adhoc] AS 'Min([adhoc])'
SELECT { [Zeit].[Hierarchie].[Jahr].[2008]} ON 0
FROM [Fallzahl Inzidenz]
WHERE ([Gebiete].[Hierarchie].[adhoc],[Hat Daten])
When I change Min back to aggregate and change the query to run with any of the out-commented [adhoc] set definitions I am also getting the desired result of 1.
WITH
--SET [adhoc] AS 'UNION([Gebiete].[Hierarchie].[Bezirk].[010],[Gebiete].[Hierarchie].[Bundesland].[10])'
--SET [adhoc] AS 'DESCENDANTS([Gebiete].[Hierarchie].[Bezirk].[010],[Gebiete].[Hierarchie].[Landkreis])'
--SET [adhoc] AS 'DESCENDANTS([Gebiete].[Hierarchie].[Bundesland].[10],[Gebiete].[Hierarchie].[Landkreis])'
MEMBER [Gebiete].[Hierarchie].[adhoc] AS 'Aggregate([adhoc])'
SELECT { [Zeit].[Hierarchie].[Jahr].[2008]} ON 0
FROM [Fallzahl Inzidenz]
WHERE ([Gebiete].[Hierarchie].[adhoc],[Hat Daten])
So I think it is a bug with the combination of UNION, DESCENDANTS and Aggregate. Can you please confirm, whether I am right and this really is a bug or whether my MDX query is wrong?
Thanks in advance
David