[Mondrian] MondrianEvaluationException when calling CurrentMember.Name over a calculated member

mehdi b mehdi_xinu at yahoo.com
Tue Sep 25 10:29:43 EDT 2012


Hi

I have a cube with calculated member called UsedCreditAvg which is defined in Measures dimenstion in the mondrian schema xml file as following

    <Cube name="CardCredit" cache="false" enabled="true" defaultMeasure="UsedCredit">
        <Table schema="BIDWH" name="SWT_CB_CRCARD_CREDIT"/>

        <DimensionUsage name="Branch" source="Branch" foreignKey="FD_BRANCH" />
        <DimensionUsage name="Date" source="Date" foreignKey="FD_DATE" />

        <Measure name="DistinctDate" column="FD_DATE" aggregator="distinct-count">
             <CalculatedMemberProperty name="applyEndMarker" value="false"/>

        </Measure>


        <Measure name="UsedCredit" column="MR_USD_CREDIT" aggregator="sum" >

             <CalculatedMemberProperty name="applyEndMarker" value="true"/>

        </Measure>


        <CalculatedMember name="UsedCreditAvg" dimension="Measures">
            <Formula>[Measures].[UsedCredit]/[Measures].[DistinctDate]</Formula>

             <CalculatedMemberProperty name="applyEndMarker" value="false"/>

        </CalculatedMember>
    </Cube>


At first, I execute the following MDX:

with 
member [Date].[NewAll] as 'iif([Measures].CurrentMember.Properties("applyEndMarker")="false", [Date].[All], [Date].LastChild.LastChild)'
select NON EMPTY {{[Date].[Month].Members}, [Date].[NewAll]} ON COLUMNS,
  {[Measures].[UsedCredit], [Measures].[UsedCreditAvg]} ON ROWS
from [CardCredit]


and I got wrong result for [Measures].[UsedCreditAvg]. Then I tried some other MDX queries, and I finally found that when I execute the following MDX:

with
member [Date].[Testtt] as '[Measures].CurrentMember.Name'
select [Date].[Testtt] on axis(0),
{[Measures].[UsedCredit], [Measures].[UsedCreditAvg]} ON axis(1)
from [CardCredit]


for [Measures].[UsedCredit], I got "UsedCredit" value, but for [Measures].[UsedCreditAvg] I got "mondrian.olap.fun.MondrianEvaluationException: Expected value of type NUMERIC; got value 'UsedCredit' (STRING)".

It seems that the CurrentMemeber.Name or CurrentMemeber.Properties() dose not work over calculated members.

So is there any solution? Is it a bug? what can I do to solve the problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20120925/7e7cdc01/attachment.html 


More information about the Mondrian mailing list