dbTalk Databases Forums  

Analysis Services 2005: MDX and Dimension Attributes/Member Properties

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Analysis Services 2005: MDX and Dimension Attributes/Member Properties in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stuart
 
Posts: n/a

Default Analysis Services 2005: MDX and Dimension Attributes/Member Properties - 09-22-2005 , 11:14 PM






Analysis Services 2005: MDX and Dimension Attributes/Member Properties

I am having problems getting Member properties using MDX in reporting
services.
I am using Adventureworks for my example here.

I have this MDX here which returns most of the results that I need:

SELECT
NON EMPTY { [Measures].[Internet Order Count] } ON COLUMNS,
NON EMPTY { ([Product].[Product Categories].[Product Name].ALLMEMBERS *

[Geography].[Geography].[Postal Code].ALLMEMBERS *
[Promotion].[Promotions].[Promotion Category].ALLMEMBERS )
} DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM (
SELECT ( { [Geography].[Geography].[City].&[Alexandria]&[NSW] } )
ON COLUMNS
FROM (
SELECT ( { [Date].[Fiscal].[Date].&[1] } ) ON COLUMNS
FROM [Adventure Works]
)
)
WHERE ( [Date].[Fiscal].[Date].&[1] )

However I now want to display the Color for the product (Product has a
number of Dimension attributes\properties, one of them being Color).

I have tried 2 approaches to getting the information that I need:
1) Calculated Members

With
Member [Measures].[Color] as
'[Product].[Product Categories].CurrentMember.Properties("Color")'
SELECT
NON EMPTY { [Measures].[Internet Order Count],[Measures].[Color] } ON
COLUMNS,
NON EMPTY { ([Product].[Product Categories].[Product Name].ALLMEMBERS *

[Geography].[Geography].[Postal Code].ALLMEMBERS *
[Promotion].[Promotions].[Promotion Category].ALLMEMBERS )
} DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM (
SELECT ( { [Geography].[Geography].[City].&[Alexandria]&[NSW] } )
ON COLUMNS
FROM (
SELECT ( { [Date].[Fiscal].[Date].&[1] } ) ON COLUMNS
FROM [Adventure Works]
)
)
WHERE ( [Date].[Fiscal].[Date].&[1] )

2) Dimension Proprties

SELECT
NON EMPTY { [Measures].[Internet Order Count] } ON COLUMNS,
NON EMPTY {[Product].[Product].[Product].Members}
DIMENSION PROPERTIES [Product].[Product].[Subcategory],
[Product].[Product].[Color], MEMBER_CAPTION, MEMBER_UNIQUE_NAME on
rows,
NON EMPTY { ([Geography].[Geography].[Postal Code].ALLMEMBERS *
[Promotion].[Promotions].[Promotion Category].ALLMEMBERS )
} DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON pages
FROM (
SELECT ( { [Geography].[Geography].[City].&[Alexandria]&[NSW] } )
ON COLUMNS
FROM (
SELECT ( { [Date].[Fiscal].[Date].&[1] } ) ON COLUMNS
FROM [Adventure Works]
)
)
WHERE ( [Date].[Fiscal].[Date].&[1] )

However both of the above approaches do not quite work, as they return
large datasets. In the 1st approach the Calculated Member is never
null, hence the non empty flag on the axis does not reduce the dataset
size. In the 2nd approach joining the rows on the pages also returns a
large dataset, most of which has empty Measure fields.

This MDX is being used in a Reporting Services report, and so the first
axis can only contain the Measures Dimension.

Does anyone have some ideas on how I can write this query to get the
result I need (ie get the color property)?


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Analysis Services 2005: MDX and Dimension Attributes/Member Properties - 09-23-2005 , 03:32 PM






The Calculated Measure approach should work, if you set it to be empty
when the measure of interest is empty:
Quote:
With
Member [Measures].[Color] as
iif(IsEmpty([Measures].[Internet Order Count]), NULL,
[Product].[Product Categories].CurrentMember.Properties("Color"))
SELECT
NON EMPTY { [Measures].[Internet Order Count],[Measures].[Color] } ON
COLUMNS,
NON EMPTY { ([Product].[Product Categories].[Product Name].ALLMEMBERS *

[Geography].[Geography].[Postal Code].ALLMEMBERS *
[Promotion].[Promotions].[Promotion Category].ALLMEMBERS )
} DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM (
SELECT ( { [Geography].[Geography].[City].&[Alexandria]&[NSW] } )
ON COLUMNS
FROM (
SELECT ( { [Date].[Fiscal].[Date].&[1] } ) ON COLUMNS
FROM [Adventure Works]
)
)
WHERE ( [Date].[Fiscal].[Date].&[1] )
Quote:

But it seems simpler to use the Color attribute:
Quote:
SELECT
NON EMPTY { [Measures].[Internet Order Count] } ON
COLUMNS,
NON EMPTY { ([Product].[Product Categories].[Product Name].ALLMEMBERS *
[Product].[Color].[Color].Members *
[Geography].[Geography].[Postal Code].ALLMEMBERS *
[Promotion].[Promotions].[Promotion Category].ALLMEMBERS )
} DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM (
SELECT ( { [Geography].[Geography].[City].&[Alexandria]&[NSW] } )
ON COLUMNS
FROM (
SELECT ( { [Date].[Fiscal].[Date].&[1] } ) ON COLUMNS
FROM [Adventure Works]
)
)
WHERE ( [Date].[Fiscal].[Date].&[1] )
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #3  
Old   
Stuart
 
Posts: n/a

Default Re: Analysis Services 2005: MDX and Dimension Attributes/Member Properties - 09-25-2005 , 03:24 PM



Deepak

Thanks a lot for your help, that worked perfectly.

Thanks

Stuart


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.