<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi folks,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>WITH MEMBER [Measures].[Sales Prev Year] AS ([Time].CurrentMember.Lag(1), [Measures].[Sales]<o:p></o:p></p><p class=MsoNormal>SELECT <o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'>{[Product].[All Products].Children} on 0, <o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'>{[Measures].[Sales], [Measures].[Sales Prev Year]} on 1<o:p></o:p></p><p class=MsoNormal>FROM <o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'>[My Cube]<o:p></o:p></p><p class=MsoNormal>WHERE <o:p></o:p></p><p class=MsoNormal> CrossJoin({[Region].[NA], [Region].[Europe]}, {[Year].[2014]})<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If folks would prefer I can add an internal property to Mondrian which allows folks to disable this behavior.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Here’s a link to my initial commit, I still have tests to write:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="https://github.com/wgorman/mondrian/commit/39d6ea62c744e7113887a051e3408f7dcb8c03d1">https://github.com/wgorman/mondrian/commit/39d6ea62c744e7113887a051e3408f7dcb8c03d1</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks!<br><br>Will<o:p></o:p></p></div></body></html>