<div dir="ltr">Hi Matt,<div>I&#39;ve been playing around this issue for a while and, in our case, have come to a solution. </div><div>Based in your hints I&#39;ve look at RolapResult@evaluateExp and implemented the same behavior defined in the constructor when executing the slicer part, and put it in the evaluateExp method. </div><div>It seems to have fixed the issue, but I haven&#39;t run any tests to see if breaks anything (I believe not).<br></div><div><br></div><div>Any thoughts ?</div><div><br></div><div>the new evaluateExp</div><div><br></div><div><br></div><div><br></div><div><br></div><div><div>Object evaluateExp(</div><div>        Calc calc,</div><div>        RolapEvaluator slicerEvaluator,</div><div>        Evaluator contextEvaluator)</div><div>    {</div><div>        int attempt = 0;</div><div><br></div><div>        RolapEvaluator evaluator = slicerEvaluator.push();</div><div>        if (contextEvaluator != null &amp;&amp; contextEvaluator.isEvalAxes()) {<br></div><div>            evaluator.setEvalAxes(true);</div><div>            evaluator.setContext(contextEvaluator.getMembers());</div><div>        }</div><div><br></div><div>        // Copied from constructor </div><div>        final TupleList tupleList = TupleCollections.asTupleList(evaluator.getSlicerMembers());</div><div>        if (tupleList.size() &gt; 1) {</div><div>            final Calc valueCalc = new ValueCalc(new DummyExp(new ScalarType()));</div><div>            final Calc calc1 =</div><div>                    new GenericCalc(</div><div>                            new DummyExp(query.slicerCalc.getType()))</div><div>                    {</div><div>                        public Object evaluate(Evaluator evaluator) {</div><div>                            TupleList list =</div><div>                                    AbstractAggregateFunDef</div><div>                                            .processUnrelatedDimensions(</div><div>                                                    tupleList, evaluator);</div><div>                            return AggregateFunDef.AggregateCalc.aggregate(</div><div>                                    valueCalc, evaluator, list);</div><div>                        }</div><div>                    };</div><div><br></div><div>            // replace the slicer set with a placeholder to avoid</div><div>            // interaction between the aggregate calc we just created</div><div>            // and any calculated members that might be present in</div><div>            // the slicer.</div><div>            // Arbitrarily picks the first dim of the first tuple</div><div>            // to use as placeholder.</div><div>            Member placeholder = setPlaceholderSlicerAxis(</div><div>                    (RolapMember) tupleList.get(0).get(0), calc1);</div><div>            evaluator.setContext(placeholder);</div><div>        }</div><div>        // Rest of the code</div><div>        .....</div><div>      </div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-14 16:52 GMT+01:00 Matt Campbell <span dir="ltr">&lt;<a href="mailto:mcampbell@pentaho.com" target="_blank">mcampbell@pentaho.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I believe the 2 workarounds are to either inline the named set directly on the axis, or use a calculated member that aggregates the set you’re currently using
 in the slicer, and place that calculated member in the slicer instead.  E.g.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">With member<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Product.agg as ‘ Aggregate(
</span>{[product].[product].[a], [product].[product].[c]}<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">)’<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Select
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">….<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">WHERE<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">( product.agg )<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">HTH<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a> [mailto:<a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a>]
<b>On Behalf Of </b>Hilario Fernandes<br>
<b>Sent:</b> Tuesday, October 14, 2014 11:42 AM<br>
<b>To:</b> Mondrian developer mailing list<br>
<b>Subject:</b> Re: [Mondrian] LastNonEmpty and slicers problem<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hey Matt,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks for the reply! I&#39;ve put the set directly on the axis and it works as expected. I&#39;ve added the information on the issue you pointed out and voted! Guess there&#39;s nothing else i can do at the moment... I&#39;m going to try and find a workaround
 of some sort...<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, Oct 14, 2014 at 1:28 PM, Matt Campbell &lt;<a href="mailto:mcampbell@pentaho.com" target="_blank">mcampbell@pentaho.com</a>&gt; wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi Hilario,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">There’s a known issue with named set evaluation in the context of a compound slicer (MONDRIAN-1654). 
 Can you try moving the [date] set directly onto the row axis to see whether you get expected numbers?  And if that
<i>is</i> your issue, vote and/or comment on the case.  I’d love to see it get addressed.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Matt</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">
<a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a> [mailto:<a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a>]
<b>On Behalf Of </b>Hilario Fernandes<br>
<b>Sent:</b> Monday, October 13, 2014 12:43 PM<br>
<b>To:</b> Mondrian mailing list<br>
<b>Subject:</b> [Mondrian] LastNonEmpty and slicers problem</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I&#39;m experiencing a weird behaviour while using the LastNonEmpty function. My MDX is as follows:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">WITH<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">SET [date] AS<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">{LastNonEmpty([date.YEAR].[YEAR].Members, [Measures].[measure_SUM])}<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">SELECT<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">NON EMPTY {[Measures].[measure_SUM]} ON COLUMNS,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">NON EMPTY {[date]} ON ROWS<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">FROM [cube]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">WHERE {[product].[product].[a], [product].[product].[c]}<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal">The schema:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">&lt;Cube name=&#39;cube&#39; visible=&#39;true&#39; cache=&#39;true&#39; enabled=&#39;true&#39;&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  &lt;Table name=&#39;CUBE_609d989076e048e2a9ee831bdeaee2b3_FACT&#39; alias=&#39;FACT_252ad422f6ae474fb25001f7586bdbd2&#39; /&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">   &lt;Dimension name=&#39;product&#39; caption=&#39;product&#39; visible=&#39;true&#39;&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    &lt;Hierarchy name=&#39;product&#39; caption=&#39;product&#39; allMemberName=&#39;Total product&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">      &lt;Level name=&#39;product&#39; caption=&#39;product&#39; visible=&#39;true&#39; column=&#39;ATTR_c7a295ae3dfa4af9acaacc56fc16c276&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39;
 /&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    &lt;/Hierarchy&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  &lt;/Dimension&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  &lt;DimensionUsage name=&#39;date&#39; source=&#39;Shared Date&#39; caption=&#39;date&#39; visible=&#39;true&#39; foreignKey=&#39;DIM_ID_b6c96b55efdd430b8b991d20f6eef622&#39; /&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  &lt;Measure caption=&#39;measure_SUM&#39; name=&#39;measure_SUM&#39; column=&#39;MEASURE_bfe8f487ff6846b58195028020207647&#39; formatString=&#39;Standard&#39; aggregator=&#39;sum&#39; /&gt;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">&lt;/Cube&gt;<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal">and the data:<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">product, date, measure<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">a,2014-01-01, 10<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">b,2014-01-01, 20<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">c,-,null<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">The problem is i&#39;d expect the above query to return the sum of the measure for the year 2014, considering the slicers, but it doesn&#39;t. Seems like the slicers aren&#39;t being properly
 applyed, and only the last of the set is considered during LastNonEmpty evaluation. In this case it returns nothing, because the measure is null for [product].[product].[c].<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Is this a known problem or am i doing something wrong? I&#39;ve been debugging mondrian code trying to understand what&#39;s going on hoping to narrow the problem and it seems to be related
 to LastNonEmpty.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I appreciate any help! Thank you!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal">--
<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hilario Fernandes<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Mondrian mailing list<br>
<a href="mailto:Mondrian@pentaho.org" target="_blank">Mondrian@pentaho.org</a><br>
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hilario Fernandes<u></u><u></u></p>
</div>
</div>
</div>
</div></div></div>
</div>

<br>_______________________________________________<br>
Mondrian mailing list<br>
<a href="mailto:Mondrian@pentaho.org">Mondrian@pentaho.org</a><br>
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><p style="line-height:15px;margin:0px"><img src="cid:image001.gif@01CE6E72.4C2B8250" alt="logo-cortex-rgb (menor)"><br></p><p style="line-height:15px;margin:0px"><b><span lang="EN-US" style="font-size:8pt;line-height:13px;font-family:Verdana,sans-serif;color:rgb(89,89,89)">Tiago Santos<u></u><u></u></span></b></p><p style="line-height:15px;margin:0px"><a href="mailto:tiago.santos@cortex-intelligence.com" style="color:rgb(17,85,204)" target="_blank"><span lang="EN-US" style="font-size:8pt;line-height:13px;font-family:Verdana,sans-serif">tiago.santos@cortex-intelligence.com</span></a><u><span lang="EN-US" style="font-size:11pt;line-height:18px;font-family:Calibri,sans-serif;color:blue"><u></u><u></u></span></u></p><p style="margin:0px"><span lang="EN-US" style="font-size:8pt;line-height:13px;font-family:Verdana,sans-serif;color:rgb(89,89,89)">Tm </span><span lang="EN-US" style="font-size:6pt;line-height:9px;font-family:Verdana,sans-serif;color:rgb(89,89,89)"> </span><span lang="EN-US" style="font-size:8pt;line-height:13px;font-family:Verdana,sans-serif;color:rgb(89,89,89)"><a value="+351910599760" style="color:rgb(17,85,204)">+351 910 599 751</a></span></p><p style="line-height:15px;margin:0px"><a href="http://www.cortex-intelligence.com/" style="color:rgb(17,85,204)" target="_blank"><b><span lang="EN-US" style="font-size:8pt;line-height:13px;font-family:Verdana,sans-serif;color:rgb(48,179,86)">www.cortex-intelligence.com</span></b></a><b><span lang="EN-US" style="font-size:11pt;line-height:18px;font-family:Calibri,sans-serif;color:rgb(48,179,86)"><u></u><u></u></span></b></p><p style="margin:0px"><span lang="PT-BR" style="font-size:8pt;font-family:Calibri,sans-serif;color:rgb(48,179,86)">Consultoria | Tecnologia | Outsourcing</span></p></div>
</div>