[Mondrian] ValidMeasure() combined with Aggregate()

Ajit Vasudeo Joglekar ajogleka at thoughtworks.com
Wed Nov 28 07:21:22 EST 2007


Julian,

Lets consider the following MDX

WITH 

MEMBER [Measures].[Unit Sales VM] as 'validMeasure([Measures].[Unit 
Sales])', SOLVE_ORDER = 3000
MEMBER [GENDER].[Aggregate Sales] AS 
        'AGGREGATE(CROSSJOIN({GENDER.GENDER.MEMBERS}, 
                [WAREHOUSE].[STATE PROVINCE].MEMBERS) ) '
 
SELECT 
 
{[Measures].[Unit Sales VM]} ON 0, 
 
{[Gender].[Aggregate Sales]} ON 1 FROM [WAREHOUSE AND SALES]


Here Measures.[Unit Sales VM] which is a valid measure has a higher solve 
order than the aggregate member, so it gets executed first and the set 
over which the aggregation happens is not yet in context.
At the time of aggregation evaluation, evaluator has [Unit Sales] in the 
context and cross join returns an expanded list, because cross join does 
not check unrelated dimensions and just expands given sets
by returning set of members. so we get a list for aggregation as:

With [Measures].[Unit Sales] and a set like this
{
([Gender].[All Gender].[M],[Warehouse].[All Warehouses].[USA].[CA]),
([Gender].[All Gender].[F],[Warehouse].[All Warehouses].[USA].[CA]),
([Gender].[All Gender].[M],[Warehouse].[All Warehouses].[USA].[WA]),
([Gender].[All Gender].[F],[Warehouse].[All Warehouses].[USA].[WA])
}

Here we need to push non joining dimensions to all level.
{
([Gender].[All Gender].[M],[Warehouse].[All Warehouses]),
([Gender].[All Gender].[F],[Warehouse].[All Warehouses]),
([Gender].[All Gender].[M],[Warehouse].[All Warehouses]),
([Gender].[All Gender].[F],[Warehouse].[All Warehouses])
}

and then cell evaluation happens on filtered list.

Here if we dont push unrelated dimensions to all level, we get null 
values.
The above list contains duplicate tuples which would result in over 
totalling and hence we need to eliminate the duplicates. 

-Ajit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20071128/1ce122e4/attachment.html 


More information about the Mondrian mailing list