dbTalk Databases Forums  

Setting Default Member based on a Member Property

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


Discuss Setting Default Member based on a Member Property in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
davidb@mercurydata.com
 
Posts: n/a

Default Setting Default Member based on a Member Property - 04-19-2005 , 03:55 PM






This topic appeared last year, but the guidance in that thread went in
a direction that wasn't valid for my situation.

In my DimDate table on which my Time dimension contains a
CurrentMonthFlag field that stores a '1' if the date is in the current
month and a '0' if it is not. This is an extremely handy field for
relaional reporting and now I want to leverage it to set my Date
dimension's Default Member property.

The dimension (hierarchy actually) I'm working with has only two levels
[Fiscal Year] and [Fiscal Month]. I've set up a Member Property Called
"Default Month" based on my CurrentMonthFlag field .

Now I want to construct a default member MDX expression that references
this field. I've tried constructing an expression using the Filter()
function:

Filter([Date].[Fiscal].[Fiscal Month].Members,
[Date].[Fiscal].CurrentMember.Properties("Default Month") = "1")

But that doesn't seem to work. It doesn't return an error, but it
doesn't set the default member. The dimension just defaults to the
first member on the Year level.

Any ideas how I can make this work? I'd be happy to scrap the Filter()
function. I just want to default to the month with the "Default Month"
property set to "1".

-David


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

Default Re: Setting Default Member based on a Member Property - 04-19-2005 , 10:46 PM






You need to explicitly select a member, since Filter() returns a set
(even if it contains just one member):

Quote:
Filter([Date].[Fiscal].[Fiscal Month].Members,
[Date].[Fiscal].CurrentMember.Properties("Default Month") = "1").Item(0)
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


Reply With Quote
  #3  
Old   
davidb@mercurydata.com
 
Posts: n/a

Default Re: Setting Default Member based on a Member Property - 04-20-2005 , 02:13 PM



This worked perfectly. And to think I was only 8 keystrokes away!

Thanks!!


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.