我终于能够弄清楚这一点,我希望它可以帮助别人。即使 XML 格式良好,甚至可以在 Schema Designer (Pentaho) 中打开,Mondrian 也不会选择超出初始度量值列表的任何度量值。例如:
<Measure name="Cnt - A" column="r_a" aggregator="count" visible="true"></Measure>
<Measure name="Cnt - B" column="r_b" aggregator="count" visible="true"></Measure>
<CalculatedMember name="Sum - A_Rolling_12" dimension="Measures" hierarchy="[A]">
<Formula>sum(parallelperiod([Business date.Time Hierarchy].[Year],1,[Business date.Time Hierarchy].CurrentMember):[Business date.Time Hierarchy].CurrentMember,[Measures].[Sum - A])</Formula>
</CalculatedMember>
<CalculatedMember name="Sum - B_Rolling_12" dimension="Measures" hierarchy="[B]">
<Formula>sum(parallelperiod([Business date.Time Hierarchy].[Year],1,[Business date.Time Hierarchy].CurrentMember):[Business date.Time Hierarchy].CurrentMember,[Measures].[Sum - B])</Formula>
</CalculatedMember>
工作正常,但是在以下情况下,B 不会显示为计算成员:
<Measure name="Cnt - A" column="r_a" aggregator="count" visible="true"></Measure>
<CalculatedMember name="Sum - A_Rolling_12" dimension="Measures" hierarchy="[A]">
<Formula>sum(parallelperiod([Business date.Time Hierarchy].[Year],1,[Business date.Time Hierarchy].CurrentMember):[Business date.Time Hierarchy].CurrentMember,[Measures].[Sum - A])</Formula>
</CalculatedMember>
<Measure name="Cnt - B" column="r_b" aggregator="count" visible="true"></Measure>
<CalculatedMember name="Sum - B_Rolling_12" dimension="Measures" hierarchy="[B]">
<Formula>sum(parallelperiod([Business date.Time Hierarchy].[Year],1,[Business date.Time Hierarchy].CurrentMember):[Business date.Time Hierarchy].CurrentMember,[Measures].[Sum - B])</Formula>
</CalculatedMember>
对我来说,这似乎是蒙德里安解析器中的一个错误,在我看来,像这样对度量进行分组是非常合乎逻辑的,甚至可以根据他们的模式进行验证,但它不起作用。希望这可以节省一些人的挫败感。