[Mondrian] LastNonEmpty and slicers problem

Hilario Fernandes hilario.fernandes at cortex-intelligence.com
Mon Oct 13 12:42:48 EDT 2014


I'm experiencing a weird behaviour while using the LastNonEmpty function.
My MDX is as follows:

SET [date] AS
{LastNonEmpty([date.YEAR].[YEAR].Members, [Measures].[measure_SUM])}

NON EMPTY {[Measures].[measure_SUM]} ON COLUMNS,

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' />
  <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' />

and the data:

product, date, measure
a,2014-01-01, 10
b,2014-01-01, 20

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20141013/b28b290b/attachment.html 

More information about the Mondrian mailing list