[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mondrian
Subject:    Re: [Mondrian] LastNonEmpty and slicers problem
From:       Tiago Santos <tiago.santos () cortex-intelligence ! com>
Date:       2014-10-16 20:55:15
Message-ID: CA+3g0kFjP9HJ1AFOwg50+3UHW4Qg1j64M7s2HsONrPpp6t0hAw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/related)]

[Attachment #4 (multipart/alternative)]


Thank you for the heads up. I'll take a look.
On Oct 16, 2014 8:55 PM, "Matt Campbell" <mcampbell@pentaho.com> wrote:

>  Hi Tiago-
>
>
>
> You've identified the basic problem:  named sets are evaluated before the
> special compound slicer member has been pushed into context.  I'm not
> really sure what the best fix is, though.  Regenerating the compound slicer
> member with every call of evaluateExp is probably not what we'd want to
> do.  IIRC, Will Gorman had done some work awhile back on addressing this
> issue.  I think he'd done some rearranging of evaluation order in the
> constructor.
>
>
>
>
>
> *From:* mondrian-bounces@pentaho.org [mailto:mondrian-bounces@pentaho.org]
> *On Behalf Of *Tiago Santos
> *Sent:* Thursday, October 16, 2014 2:14 PM
> *To:* Mondrian developer mailing list
> *Subject:* Re: [Mondrian] LastNonEmpty and slicers problem
>
>
>
> Hi Matt,
>
> I've been playing around this issue for a while and, in our case, have
> come to a solution.
>
> Based in your hints I'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.
>
> It seems to have fixed the issue, but I haven't run any tests to see if
> breaks anything (I believe not).
>
>
>
> Any thoughts ?
>
>
>
> the new evaluateExp
>
>
>
>
>
>
>
>
>
> Object evaluateExp(
>
>         Calc calc,
>
>         RolapEvaluator slicerEvaluator,
>
>         Evaluator contextEvaluator)
>
>     {
>
>         int attempt = 0;
>
>
>
>         RolapEvaluator evaluator = slicerEvaluator.push();
>
>         if (contextEvaluator != null && contextEvaluator.isEvalAxes()) {
>
>             evaluator.setEvalAxes(true);
>
>             evaluator.setContext(contextEvaluator.getMembers());
>
>         }
>
>
>
>         // Copied from constructor
>
>         final TupleList tupleList =
> TupleCollections.asTupleList(evaluator.getSlicerMembers());
>
>         if (tupleList.size() > 1) {
>
>             final Calc valueCalc = new ValueCalc(new DummyExp(new
> ScalarType()));
>
>             final Calc calc1 =
>
>                     new GenericCalc(
>
>                             new DummyExp(query.slicerCalc.getType()))
>
>                     {
>
>                         public Object evaluate(Evaluator evaluator) {
>
>                             TupleList list =
>
>                                     AbstractAggregateFunDef
>
>                                             .processUnrelatedDimensions(
>
>                                                     tupleList, evaluator);
>
>                             return AggregateFunDef.AggregateCalc.aggregate(
>
>                                     valueCalc, evaluator, list);
>
>                         }
>
>                     };
>
>
>
>             // replace the slicer set with a placeholder to avoid
>
>             // interaction between the aggregate calc we just created
>
>             // and any calculated members that might be present in
>
>             // the slicer.
>
>             // Arbitrarily picks the first dim of the first tuple
>
>             // to use as placeholder.
>
>             Member placeholder = setPlaceholderSlicerAxis(
>
>                     (RolapMember) tupleList.get(0).get(0), calc1);
>
>             evaluator.setContext(placeholder);
>
>         }
>
>         // Rest of the code
>
>         .....
>
>
>
>
>
>
>
> 2014-10-14 16:52 GMT+01:00 Matt Campbell <mcampbell@pentaho.com>:
>
>  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.
>
>
>
> With member
>
> Product.agg as ‘ Aggregate( {[product].[product].[a],
> [product].[product].[c]})'
>
> Select
>
> ….
>
> WHERE
>
> ( product.agg )
>
>
>
>
>
> HTH
>
>
>
> *From:* mondrian-bounces@pentaho.org [mailto:mondrian-bounces@pentaho.org]
> *On Behalf Of *Hilario Fernandes
> *Sent:* Tuesday, October 14, 2014 11:42 AM
> *To:* Mondrian developer mailing list
> *Subject:* Re: [Mondrian] LastNonEmpty and slicers problem
>
>
>
> Hey Matt,
>
>
>
> Thanks for the reply! I've put the set directly on the axis and it works
> as expected. I've added the information on the issue you pointed out and
> voted! Guess there's nothing else i can do at the moment... I'm going to
> try and find a workaround of some sort...
>
>
>
> On Tue, Oct 14, 2014 at 1:28 PM, Matt Campbell <mcampbell@pentaho.com>
> wrote:
>
>
>
> Hi Hilario,
>
> 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 *is* your issue, vote and/or comment on the case.  I'd love to see
> it get addressed.
>
>
>
> Matt
>
>
>
>
>
> *From:* mondrian-bounces@pentaho.org [mailto:mondrian-bounces@pentaho.org]
> *On Behalf Of *Hilario Fernandes
> *Sent:* Monday, October 13, 2014 12:43 PM
> *To:* Mondrian mailing list
> *Subject:* [Mondrian] LastNonEmpty and slicers problem
>
>
>
> Hi,
>
>
>
> I'm experiencing a weird behaviour while using the LastNonEmpty function.
> My MDX is as follows:
>
>
>
> WITH
>
> SET [date] AS
>
> {LastNonEmpty([date.YEAR].[YEAR].Members, [Measures].[measure_SUM])}
>
>
>
> SELECT
>
> NON EMPTY {[Measures].[measure_SUM]} ON COLUMNS,
>
> NON EMPTY {[date]} ON ROWS
>
>
>
> FROM [cube]
>
> WHERE {[product].[product].[a], [product].[product].[c]}
>
>
>
> The schema:
>
>
>
> <Cube name='cube' visible='true' cache='true' enabled='true'>
>
>   <Table name='CUBE_609d989076e048e2a9ee831bdeaee2b3_FACT'
> alias='FACT_252ad422f6ae474fb25001f7586bdbd2' />
>
>    <Dimension name='product' caption='product' visible='true'>
>
>     <Hierarchy name='product' caption='product' allMemberName='Total
> product' visible='true' hasAll='true'>
>
>       <Level name='product' caption='product' visible='true'
> column='ATTR_c7a295ae3dfa4af9acaacc56fc16c276' uniqueMembers='true'
> levelType='Regular' hideMemberIf='Never' type='String' />
>
>     </Hierarchy>
>
>   </Dimension>
>
>   <DimensionUsage name='date' source='Shared Date' caption='date'
> visible='true' foreignKey='DIM_ID_b6c96b55efdd430b8b991d20f6eef622' />
>
>   <Measure caption='measure_SUM' name='measure_SUM'
> column='MEASURE_bfe8f487ff6846b58195028020207647' formatString='Standard'
> aggregator='sum' />
>
> </Cube>
>
>
>
> and the data:
>
>
>
> product, date, measure
>
> a,2014-01-01, 10
>
> b,2014-01-01, 20
>
> c,-,null
>
>
>
> The problem is i'd expect the above query to return the sum of the measure
> for the year 2014, considering the slicers, but it doesn't. Seems like the
> slicers aren'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].
>
>
>
> Is this a known problem or am i doing something wrong? I've been debugging
> mondrian code trying to understand what's going on hoping to narrow the
> problem and it seems to be related to LastNonEmpty.
>
>
>
> I appreciate any help! Thank you!
>
>
>
>
>
> --
>
> Hilario Fernandes
>
>
> _______________________________________________
> Mondrian mailing list
> Mondrian@pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
>
>
>
>
> --
>
> Hilario Fernandes
>
>
> _______________________________________________
> Mondrian mailing list
> Mondrian@pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
>
>
>
>
> --
>
> [image: logo-cortex-rgb (menor)]
>
> *Tiago Santos*
>
> tiago.santos@cortex-intelligence.com
>
> Tm  +351 910 599 751
>
> *www.cortex-intelligence.com* <http://www.cortex-intelligence.com/>
>
> Consultoria | Tecnologia | Outsourcing
>
> _______________________________________________
> Mondrian mailing list
> Mondrian@pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
>

[Attachment #7 (text/html)]

<p dir="ltr">Thank you for the heads up. I&#39;ll take a look.</p>
<div class="gmail_quote">On Oct 16, 2014 8:55 PM, &quot;Matt Campbell&quot; &lt;<a \
href="mailto:mcampbell@pentaho.com">mcampbell@pentaho.com</a>&gt; wrote:<br \
type="attribution"><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">Hi \
Tiago-<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">You've \
identified the basic problem:   named sets are evaluated before the special compound \
slicer member has been pushed into context.   I'm not really sure  what the best fix \
is, though.   Regenerating the compound slicer member with every call of evaluateExp \
is probably not what we'd want to do.   IIRC, Will Gorman had done some work awhile \
back on addressing this issue.   I think he'd done some rearranging of evaluation  \
order in the constructor.<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"><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>Tiago \
Santos<br> <b>Sent:</b> Thursday, October 16, 2014 2:14 PM<br>
<b>To:</b> Mondrian developer mailing list<br>
<b>Subject:</b> Re: [Mondrian] LastNonEmpty and slicers \
problem<u></u><u></u></span></p> <p class="MsoNormal"><u></u>  <u></u></p>
<div>
<p class="MsoNormal">Hi Matt,<u></u><u></u></p>
<div>
<p class="MsoNormal">I&#39;ve been playing around this issue for a while and, in our \
case, have come to a solution.  <u></u><u></u></p> </div>
<div>
<p class="MsoNormal">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.  <u></u><u></u></p> </div>
<div>
<p class="MsoNormal">It seems to have fixed the issue, but I haven&#39;t run any \
tests to see if breaks anything (I believe not).<u></u><u></u></p> </div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">Any thoughts ?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">the new evaluateExp<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>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">Object evaluateExp(<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            Calc calc,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            RolapEvaluator slicerEvaluator,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            Evaluator contextEvaluator)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">      {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            int attempt = 0;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">            RolapEvaluator evaluator = \
slicerEvaluator.push();<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">            if (contextEvaluator != null &amp;&amp; \
contextEvaluator.isEvalAxes()) {<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                  evaluator.setEvalAxes(true);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">                  \
evaluator.setContext(contextEvaluator.getMembers());<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>
<div>
<p class="MsoNormal">            // Copied from constructor  <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            final TupleList tupleList = \
TupleCollections.asTupleList(evaluator.getSlicerMembers());<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">            if (tupleList.size() &gt; 1) {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">                  final Calc valueCalc = new ValueCalc(new \
DummyExp(new ScalarType()));<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                  final Calc calc1 =<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">                              new GenericCalc(<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">                                          new \
DummyExp(query.slicerCalc.getType()))<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                              {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">                                    public Object \
evaluate(Evaluator evaluator) {<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                                          TupleList list \
=<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                                                      \
AbstractAggregateFunDef<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                                                                 \
.processUnrelatedDimensions(<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                                                                 \
tupleList, evaluator);<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                                          return \
AggregateFunDef.AggregateCalc.aggregate(<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                                                      valueCalc, \
evaluator, list);<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>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">                  // replace the slicer set with a placeholder \
to avoid<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                  // interaction between the aggregate calc we \
just created<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                  // and any calculated members that might be \
present in<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                  // the slicer.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">                  // Arbitrarily picks the first dim of the \
first tuple<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                  // to use as placeholder.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">                  Member placeholder = \
setPlaceholderSlicerAxis(<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                              (RolapMember) \
tupleList.get(0).get(0), calc1);<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">                  \
evaluator.setContext(placeholder);<u></u><u></u></p> </div>
<div>
<p class="MsoNormal">            }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            // Rest of the code<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>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
<div>
<p class="MsoNormal">2014-10-14 16:52 GMT+01:00 Matt Campbell &lt;<a \
href="mailto:mcampbell@pentaho.com" \
target="_blank">mcampbell@pentaho.com</a>&gt;:<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">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.</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">With \
member</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">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">)'</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">Select
 </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">WHERE</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">( \
product.agg )</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"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">HTH</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> 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</span><u></u><u></u></p> <div>
<div>
<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-top:5.0pt;margin-right:0in;margin-bottom:5.0pt"> <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>
<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>
<p style="margin:0in;margin-bottom:.0001pt"><img border="0" width="116" height="46" \
src="cid:image001.gif@01CFE959.221534D0" alt="logo-cortex-rgb \
(menor)"><u></u><u></u></p> <p \
style="margin:0in;margin-bottom:.0001pt;line-height:11.25pt"><b><span \
style="font-size:8.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#595959">Tiago \
Santos</span></b><u></u><u></u></p> <p style="margin:0in;margin-bottom:.0001pt"><a \
href="mailto:tiago.santos@cortex-intelligence.com" target="_blank"><span \
style="font-size:8.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1155cc">tiago.santos@cortex-intelligence.com</span></a><u></u><u></u></p>
 <p style="margin:0in;margin-bottom:.0001pt"><span \
style="font-size:8.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#595959">Tm \
</span><span style="font-size:6.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#595959"> \
</span><span style="font-size:8.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#595959">+351
  910 599 751</span><u></u><u></u></p>
<p style="margin:0in;margin-bottom:.0001pt"><a \
href="http://www.cortex-intelligence.com/" target="_blank"><b><span \
style="font-size:8.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#30b356">www.cortex-intelligence.com</span></b></a><u></u><u></u></p>
 <p style="margin:0in;margin-bottom:.0001pt"><span lang="PT-BR" \
style="font-size:8.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#30b356">Consultoria \
| Tecnologia | Outsourcing</span><u></u><u></u></p> </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>


["image001.gif" (image/gif)]

_______________________________________________
Mondrian mailing list
Mondrian@pentaho.org
http://lists.pentaho.org/mailman/listinfo/mondrian


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic