I have a difficult time understanding why a simple MDX query returns different results if a dimension has an additional attribute which has KeyColumns same as KeyColumns of the key attribute.
Here is an example
- Create a simple cube called Adventure Works based on the AdventureWorksDW2017 database with just one measure Internet Sales Count and one dimension Product which has two attributes Product and Style.
- Now run the following MDX query
WITH MEMBER TEST AS
(
[Product].[Style].&[U], [Measures].[Internet Sales Count]
)
MEMBER TEST2 AS
(
[Product].[Style].&[U], [Measures].[Internet Sales Count], [Product].[Product].CurrentMember
)
SELECT { [Measures].[Internet Sales Count], TEST, TEST2} on COLUMNS,
NON EMPTY {[Product].[Product].[All].Children} on ROWS
FROM [Adventure Works]
WHERE ([Product].[Style].&[U])
Notice that TEST measure returns the same value for all products.
- Now go back to the project and add a Product Key attribute to the dimension. There is nothing special about this attribute. It gets created with default attribute relationship.
There is nothing special about it on the Dimension Usage tab
Deploy the changes and process the cube. Now the same query returns a different result. Note all three measures return the same value.
Can anyone explain please what is going on here or point to the documentation which describes this behavior? Could it be a bug in SQL Server Analysis Services?
I am using SQL Server 2017 Developer Edition CU20. Here is a link to the multidimensional project