dbTalk Databases Forums  

USING MDX TO DYNAMICALLY DETERMINE THE CURRENT HIERARCHY OF A DIMENSION

comp.databases.olap comp.databases.olap


Discuss USING MDX TO DYNAMICALLY DETERMINE THE CURRENT HIERARCHY OF A DIMENSION in the comp.databases.olap forum.



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

Default USING MDX TO DYNAMICALLY DETERMINE THE CURRENT HIERARCHY OF A DIMENSION - 02-04-2004 , 06:59 AM






I am trying to use MDX to dynamically determine which hierarchy of the
time dimension is selected. I have a calculated member which is using
the last non-empty descendant of the [Time].[Calendar] dimension, but
I want it to work even if Fiscal is selected instead of Calendar.
Here is the code

SUM(Tail(Filter(Descendants([Time].[Calendar].CurrentMember, [Calendar
Date]), isEmpty([Measures].[Employee Count]) = False), 1),
[Measures].[Employee Count])


What can I put in place of [Time].[Calendar].CurrentMember to take the
current hierarchy of the time dimension instead of the Calendar
hierarchy? Thanks!

Reply With Quote
  #2  
Old   
Richard Tkachuk [MS]
 
Posts: n/a

Default Re: USING MDX TO DYNAMICALLY DETERMINE THE CURRENT HIERARCHY OF A DIMENSION - 02-24-2004 , 01:46 PM






Assuming you've got an all member in the two heirarchies so your calendars
don't interfere with each other, try this:

iif (not Time.Calendar.currentmember is time.calendar.defaultmember),

SUM(Tail(Filter(Descendants([Time].[Calendar].CurrentMember, [Calendar
Date]), isEmpty([Measures].[Employee Count]) = False), 1),
[Measures].[Employee Count])

,

SUM(Tail(Filter(Descendants([Time].[Fiscal].CurrentMember, [Fiscal
Date]), isEmpty([Measures].[Employee Count]) = False), 1),
[Measures].[Employee Count])

)

You'll need to tweek this if both the currentmembers are the defaultmembers
or if neither are, but the approach should work.

Hope this helps,
Richard


--
This posting is provided 'AS IS' with no warranties, and confers no rights.


"Sara" <sara2thebradley (AT) yahoo (DOT) com> wrote

Quote:
I am trying to use MDX to dynamically determine which hierarchy of the
time dimension is selected. I have a calculated member which is using
the last non-empty descendant of the [Time].[Calendar] dimension, but
I want it to work even if Fiscal is selected instead of Calendar.
Here is the code

SUM(Tail(Filter(Descendants([Time].[Calendar].CurrentMember, [Calendar
Date]), isEmpty([Measures].[Employee Count]) = False), 1),
[Measures].[Employee Count])


What can I put in place of [Time].[Calendar].CurrentMember to take the
current hierarchy of the time dimension instead of the Calendar
hierarchy? 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.