dbTalk Databases Forums  

Dynamic Default member ?

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


Discuss Dynamic Default member ? in the microsoft.public.sqlserver.olap forum.



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

Default Dynamic Default member ? - 04-05-2004 , 10:56 PM






Hi All,

I need to set default member of my time dimension to be 'Current Period' of
my system not based on system date , Now().
The 'Current Period' of the system is stored in a record in Parameter File /
Table, a table that only has one record, Table : AppPara, Column :
CurrPeriod (Int, YYYYMM).
E.g : even if we are in April now by system date, but the period of the
system is still 200403.

MDX Expression below, instead of relying on Now() function, what if I want
to refer to the value of CurrPeriod in AppPara table ??

StrToMember("Time.["+Iif(Year(Now())>=1998,"1998",Str(Year(Now())))+" ].[Q"+i
if(Month(Now())<=3,"1",iif(Month(Now())<=6,"2",iif (Month(Now())<=9,"3","4"))
)+"].&["+Str(Month(Now()))+"]")

Thank you for any help,
Trist



Reply With Quote
  #2  
Old   
Tom Chester
 
Posts: n/a

Default Re: Dynamic Default member ? - 04-06-2004 , 01:13 AM






Other than via a custom function, which has drawbacks, there's no way to
reference relational objects from MDX. Maybe you can join this param table
with your time dimension table, and then create a member property based on
the current date.

public @ the domain below
www.tomchester.net

"tristant" <krislioe (AT) cbn (DOT) net.id> wrote

Quote:
Hi All,

I need to set default member of my time dimension to be 'Current Period'
of
my system not based on system date , Now().
The 'Current Period' of the system is stored in a record in Parameter File
/
Table, a table that only has one record, Table : AppPara, Column :
CurrPeriod (Int, YYYYMM).
E.g : even if we are in April now by system date, but the period of the
system is still 200403.

MDX Expression below, instead of relying on Now() function, what if I
want
to refer to the value of CurrPeriod in AppPara table ??


StrToMember("Time.["+Iif(Year(Now())>=1998,"1998",Str(Year(Now())))+" ].[Q"+i

if(Month(Now())<=3,"1",iif(Month(Now())<=6,"2",iif (Month(Now())<=9,"3","4"))
)+"].&["+Str(Month(Now()))+"]")

Thank you for any help,
Trist





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.