Hi,
I have run into a problem that I would appreciate if you can provide some insight into. As you will see I have a workaround for my project at work, this question is just for my own understanding of the matter. When defining a calculated measure that has a fixed member of a certain attribute (e.g. Sales for Quarter 1 2013) I get different results depending on if I use a user defined hierarchy or an attribute hierarchy to define the measure. The attribute relationships have been defined correctly. I know that in assignments in MDX scripts the value of a cell can be overwritten either using a user hierarchy or an attribute hierarchy and the results are the same. I expected to see the same behavior for a calculated member regardless of which hierarchy I used.
I have reproduced the problem in AdventueWorks. Please look at the following:
WITHMEMBER [Measures].[Fixed Quarter UDH]AS--Calc defined with User Defined Hierarchy
(
[Measures].[Reseller Sales Amount] , [Date].[Calendar].[Calendar Quarter].&[2008]&[1]--[Q1 CY 2008]
)
MEMBER [Measures].[Fixed Quarter AH]AS--Calc defined with Attribute Hierarchy
(
[Measures].[Reseller Sales Amount] , [Date].[Calendar Quarter].[Calendar Quarter].&[2008]&[1]--[Q1 CY 2008]
)
SELECT
{
[Measures].[Reseller Sales Amount],
[Measures].[Fixed Quarter AH],
[Measures].[Fixed Quarter UDH]
}
ONCOLUMNS,
{[Date].[Date].[Date].&[20080101],
[Date].[Date].[Date].&[20080501]}
//[Date].[Calendar].Members
ONROWS
FROM
[Adventure Works]
This is what I get back:
How would you explain the different results from the two calculated measures. The Fixed Quarter UDH is correctly returning what I am after and it does give me what I am looking for as far as my client wants. However I would like to understand why the other calculation is behaving the say it does.? Based on the outcome I guess that when I use the user defined hierarchy (after overwrite semantics apply), the end result is that days are set to all days and the quarter is set to Quarter 1 of 2008. On the other hand, the calculation that uses the attribute hierarchy, as long as the day rolls up to the quarter, returns the value of that day, else returns NULL.
I put on calculation in the query at a time and looked at the Query Subcube generated. The subcubes are different:
Part of the Subcube event for the calculation using attribute hierarchy:
Dimension 5 [Date] (0 0 14 0 0 0 2 6 13 140 5 0 0 0 0 0 0 5 168 51 2) [Fiscal Year]:0 [Date]:0 [Calendar Quarter]:[Q1 CY 2008] [Fiscal Quarter]:0 [Calendar Semester]:0 [Fiscal Semester]:0 [Day of Week]:[3] [Day Name]:[Tuesday] [Day of Month]:[1] [Day of Year]:[1] [Calendar Week]:[Week 1 CY 2008] [Month Name]:0 [Calendar Year]:0 [Fiscal Semester of Year]:0 [Calendar Semester of Year]:0 [Fiscal Quarter of Year]:0 [Calendar Quarter of Year]:0 [Month of Year]:[January] [Fiscal Week]:[Week 28 FY 2008] [Calendar Week of Year]:[CY Week 1] [Fiscal Week of Year]:[FY Week 28]
Part of the subcube event for the calculation using the user defined hierarchy:
Dimension 5 [Date] (0 0 14 0 12 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0) [Fiscal Year]:0 [Date]:0 [Calendar Quarter]:[Q1 CY 2008] [Fiscal Quarter]:0 [Calendar Semester]:[H1 CY 2008] [Fiscal Semester]:0 [Day of Week]:0 [Day Name]:0 [Day of Month]:0 [Day of Year]:0 [Calendar Week]:0 [Month Name]:0 [Calendar Year]:[CY 2008] [Fiscal Semester of Year]:0 [Calendar Semester of Year]:0 [Fiscal Quarter of Year]:0 [Calendar Quarter of Year]:0 [Month of Year]:0 [Fiscal Week]:0 [Calendar Week of Year]:0 [Fiscal Week of Year]:0
If you run the above query and put [Date].[Calendar].[Members] , you will see that the [Fixed Quarter AH] comes back as I expect it to set to the quarter value for the All, Year, Semester and Quarter levels. It is at the Month and Day levels that I cannot explain what’s going on.
Interestingly, if you create a similar query using the Geography dimension, this behavior does not exist.
With
Member [Measures].[GA Sales AH]AS
([Measures].[Reseller Sales Amount] , [Geography].[State-Province].[State-Province].&[GA]&[US])
Member [Measures].[GA Sales UDH]AS
([Measures].[Reseller Sales Amount] ,[Geography].[Geography].[State-Province].&[GA]&[US])
SELECT {[Measures].[GA Sales AH], [Measures].[GA Sales UDH]
}ONCOLUMNS,
[Geography].[Geography].MembersONROWS
FROM [Adventure Works]
This is the results and the two calculations are both correct. In the profiler, they both generate the same subcube.
The only difference between Date and Geography that I noticed is that the Geography dimension does not use the GeographyKey (The Key Attribute) in the user defined hierarchy.
I have consulted several books and articles about strong attribute relationships, hierarchies and SSAS overwrite semantics to refresh my memory. As far as overwrite semantics there are not that many in depth articles available, there are some high level examples in the books but they all use the user defined hierarchies.
I appreciate any help, clues, or resources you can provide. I get the same results on SSAS 2012 and SSAS 2008 R2.
Thanks,
Shabnam