dbTalk Databases Forums  

MDX - How to get Number of Years Selected

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


Discuss MDX - How to get Number of Years Selected in the microsoft.public.sqlserver.olap forum.



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

Default MDX - How to get Number of Years Selected - 06-07-2006 , 08:28 AM






Dimension: Calendar.Year.Period

User filters on 2005 and 2006

How do we use mdx to count the number of years filtered on?

The answer should = 2

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

Default Re: MDX - How to get Number of Years Selected - 06-07-2006 , 07:36 PM






Depends on the version of Analysis Services and the client tool -
assuming AS 2005 and Excel 2003, this entry from Mosha's blog should
help. Something like Count(Existing [Time].[Year].[Year].Members):

http://sqljunkies.com/WebLog/mosha/a...005/11/18.aspx
Quote:
Writing multiselect friendly MDX calculations
...
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: MDX - How to get Number of Years Selected - 06-08-2006 , 08:48 AM



Thanks Deepak! Why is Year 2x in the mdx expression when the hierarchy is
Time.Year.Period ?

I am new to mdx.

p

"Deepak Puri" wrote:

Quote:
Depends on the version of Analysis Services and the client tool -
assuming AS 2005 and Excel 2003, this entry from Mosha's blog should
help. Something like Count(Existing [Time].[Year].[Year].Members):

http://sqljunkies.com/WebLog/mosha/a...005/11/18.aspx

Writing multiselect friendly MDX calculations
...



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: MDX - How to get Number of Years Selected - 06-08-2006 , 01:50 PM



Could you clarify the context in which "Year 2x" appears - I couldn't
find it in the referenced blog entry?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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

Reply With Quote
  #5  
Old   
paulbihs
 
Posts: n/a

Default Re: MDX - How to get Number of Years Selected - 06-08-2006 , 02:01 PM



From your example:

Count(Existing [Time].[Year].[Year].Members):

"Deepak Puri" wrote:

Quote:
Could you clarify the context in which "Year 2x" appears - I couldn't
find it in the referenced blog entry?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: MDX - How to get Number of Years Selected - 06-09-2006 , 12:58 PM



OK - that's typical for attribute hierarchies in AS 2005. For example,
in the Adventure Works Date dimension, the year level of the [Calendar
Year] attribute is:

[Date].[Calendar Year].[Calendar Year]


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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

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.