dbTalk Databases Forums  

a weird behavior with calculated member

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


Discuss a weird behavior with calculated member in the microsoft.public.sqlserver.olap forum.



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

Default a weird behavior with calculated member - 09-22-2006 , 11:54 AM






i have the following tables:
a.. a membership fact table: id (PK), date (datetime), clubFK, level
(integer), fee(money)
b.. a time dimension table populated by the server: date(PK), month, year
etc,
c.. a club dimension table: id(PK), etc.
there are three dimensions based on these tables. the default measure group
is called 'Basic' and contains [Price] which corresponds to the fee column.
i created a calculated member [Median Price] to calculate the median fee for
a particular club at particular level:

median(exists([Membership].[Id].[All].children,
[Time].[Time].currentmember.children*[Membership].[Level].currentmember*[Club].[Id].currentmember,
'Basic'), [Measures].[Price])

the MDX query i use is something like:

select [Time].[Time].[Calendar 2006].[July 2006] on 0, [Level].[2] on 1,
[Club].[Id].[25]) on 2 from [Memberships] where [Measures].[Median Price]

i've noticed that if i changed the definition of [Median Price] to:

// remove [Club].[Id].currentmember from the join

median(exists([Membership].[Id].[All].children,
[Time].[Time].currentmember.children*[Membership].[Level].currentmember,
'Basic'), [Measures].[Price])

i still get the same and correct result for [Median Price]. however if i
modified the definition to:

//remove [Membership].[Level].currentmember*[Club].[Id].currentmember from
the join

median(exists([Membership].[Id].[All].children,
[Time].[Time].currentmember.children, 'Basic'), [Measures].[Price])

or to

//remove [Membership].[Level].currentmember from the join

median(exists([Membership].[Id].[All].children,
[Time].[Time].currentmember.children*[Membership].[Level].currentmember,
'Basic'), [Measures].[Price])

i only get aggregated results for all Levels. i couldn't really explain this
behavior. the only difference between the [Membership].[Level] and
[Club].[Id] is that one is based on the fact table and the other is on a
dimension table. there is no default member explicitly defined for either
attribute. maybe it has to do with the scope and context for the calculated
member? i expect that only the original definition of [Median Price] to work
and the first modificatin would return a result aggregated across all clubs.
maybe my understanding of how calculated member works is completely flawed?



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.