dbTalk Databases Forums  

Strange MDX behaviour.

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


Discuss Strange MDX behaviour. in the microsoft.public.sqlserver.olap forum.



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

Default Strange MDX behaviour. - 07-11-2006 , 07:48 AM






Hi, MDX gurus,

I have a unexplainable problem with pretty easy MDX.

Following MDX queries

//
select
Filter([Date].[Date].members,
[Date].[Date].CurrentMember.MemberValue = VBA![dateadd]("yyyy", -2,
VBA![Date]()) )
on 0,
{} on 1
from [Adventure Works]
//
select
Filter([Date].[Date].members,
[Date].[Date].CurrentMember.MemberValue = CDate("11.07.2004"))
on 0,
{} on 1
from [Adventure Works]

provide the same result as expected.



This query
//
select
Filter([Date].[Calendar].[Month].members,
[Date].[Date].CurrentMember.MemberValue = CDate("11.07.2004"))
on 0,
{} on 1
from [Adventure Works]

returns as expected one member

but this query
select
Filter([Date].[Calendar].[Month].members,
[Date].[Date].CurrentMember.MemberValue = VBA![dateadd]("yyyy", -2,
VBA![Date]()) )
on 0,
{} on 1
from [Adventure Works]

retuns nothing. This is strange, isn't it?
Can anybody explain it?

Thanks in advance,

Vladimir Chtepa











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

Default Re: Strange MDX behaviour. - 07-11-2006 , 12:49 PM






Hi Vladimir,

I can't explain the discrepancy, but am wondering why you say that:

Quote:
This query
//
select
Filter([Date].[Calendar].[Month].members,
[Date].[Date].CurrentMember.MemberValue = CDate("11.07.2004"))
on 0,
{} on 1
from [Adventure Works]

returns as expected one member
Quote:

Since the [Date].[Date] attribute is at a finer granularity than
[Date].[Calendar].[Month], I would expect the [All] member to be the
[Date].[Date] current member, as in this query; so I don't understand
how your query finds a match:

Quote:
With Member [Measures].[DateValue] as
[Date].[Date].CurrentMember.MemberValue
select
{[Measures].[DateValue]} on 0,
[Date].[Calendar].[Month].members on 1
from [Adventure Works]
---------------------------------------
DateValue
July 2001 All Periods
August 2001 All Periods
September 2001 All Periods
...
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


Reply With Quote
  #3  
Old   
Vladimir Chtepa
 
Posts: n/a

Default Re: Strange MDX behaviour. - 07-11-2006 , 04:36 PM



Why are you woundering from my words?

"Deepak Puri" <deepak_puri (AT) progressive (DOT) com> wrote

Quote:
Hi Vladimir,

I can't explain the discrepancy, but am wondering why you say that:


This query
//
select
Filter([Date].[Calendar].[Month].members,
[Date].[Date].CurrentMember.MemberValue = CDate("11.07.2004"))
on 0,
{} on 1
from [Adventure Works]

returns as expected one member



Since the [Date].[Date] attribute is at a finer granularity than
[Date].[Calendar].[Month], I would expect the [All] member to be the
[Date].[Date] current member, as in this query; so I don't understand
how your query finds a match:


With Member [Measures].[DateValue] as
[Date].[Date].CurrentMember.MemberValue
select
{[Measures].[DateValue]} on 0,
[Date].[Calendar].[Month].members on 1
from [Adventure Works]
---------------------------------------
DateValue
July 2001 All Periods
August 2001 All Periods
September 2001 All Periods
..



- 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.