Is it possible to define a default member in dimension X based on the current member of dimensions Y.
E.g. I have 2 dimensions Cust (Customer) and Ver (version).
Suppose I have the following facts:
Customer 1, version 1
Customer 1, version 2
Customer 2, version 1
Customer 2, version 2
Customer 2, version 3
The default member in the version dimension should be the highest version for this specific Customer.
Customer 1, version 2
Customer 2, version 3
I wrote the following MDX
(TAIL(NONEMPTY({[Ver].[Ver - Ver].children}, [Cust].[Cust - Cust].CurrentMember), 1)).Item(0)
However this returns the following error when I try to browse the cube from BIDS.
DefaultMember(Ver,Ver) (1, 46) The dimension '[Cust]' was not found in the cube when the string, [Cust].[Cust - Cust], was parsed.
When I connect from Excel, the default member is ignored and the ALL level is used.
Answer:
What I would do is to add a record into your version table called "Latest" or "Current" or something like that. Then I would setup this new member as the default member and add a script like the following to the cube.
SCOPE ([Ver].[Ver - Ver].[Current]);
this = Aggregate(EXISTING [Cust].[Cust - Cust].Members
, TAIL(NONEMPTY({[Ver].[Ver - Ver].children} ), 1).Item(0)
)
END SCOPE;
This script finds all of the customers currently in context and then finds the last version for each one and aggregates them all together.
The problem with using .CurrentMember in a default member declaration is that .CurrentMember returns the member currently in context for a given query. The default member is established before any queries take place, so there is no .CurrentMember.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2394139&SiteID=1
Source Click Here.


Post a Comment