[Mondrian] Compound Slicers

Julian Hyde julianhyde at gmail.com
Tue May 20 14:50:49 EDT 2014


Will,

This is great work. I don't know whether it complies with the MDX language specification, but it should make it easier to write calculations, and should improve efficiency too.

I think it should be enabled using a property (enabled by default, but it should be possible to disable it so we can compare the previous behavior).

We could consider taking this further: analyze the compound slicer at prepare time, and separate out into constant members and expressions. This is like factoring the algebraic expression a.b + a.c into a.(b + c).

Julian


On May 20, 2014, at 11:09 AM, Will Gorman <wgorman at pentaho.com> wrote:

> Hi folks,
>  
> I’ve been doing some work on compound slicers and figured I’d share, also wanted to know if anyone else is working with them in any way.   Mondrian treats compound slicers as an aggregate calculation that gets added to the evaluation context.  This was causing problems for us when trying to reference members within the compound slicer within other calculations.  For instance:
>  
> WITH MEMBER [Measures].[Sales Prev Year] AS ([Time].CurrentMember.Lag(1), [Measures].[Sales]
> SELECT
> {[Product].[All Products].Children} on 0,
> {[Measures].[Sales], [Measures].[Sales Prev Year]} on 1
> FROM
> [My Cube]
> WHERE
>                CrossJoin({[Region].[NA], [Region].[Europe]}, {[Year].[2014]})
>  
> In this use case, [Sales Prev Year] would return the same value as the current year, due to the aggregate calculation overwriting the context back to Year 2014 vs. 2013.
>  
> My solution was to use a hybrid approach for the compound slicer.  After we evaluate the tuples in the slicer, I removed the members that were repeated.  In this case Year 2014 would get removed from the aggregate calculation, and instead act in the way a regular slicer would, becoming part of the slicerEvaluator.  This seems to have fixed the problem, and also changed the behavior of CompoundSlicerTest.testRollupAvg(), which now behaves the same for both  the set use case and compound slicer use case.
>  
> If folks would prefer I can add an internal property to Mondrian which allows folks to disable this behavior.
>  
> Here’s a link to my initial commit, I still have tests to write:
>  
> https://github.com/wgorman/mondrian/commit/39d6ea62c744e7113887a051e3408f7dcb8c03d1
>  
> Thanks!
> 
> Will
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20140520/969d6c2e/attachment.html 


More information about the Mondrian mailing list