简体   繁体   English

如何在Pentaho Mondrian模式XML中使用公式

[英]how to use formula in Pentaho Mondrian schema XML

I'm working on Saiku reports in ReportServer. 我正在研究ReportServer中的Saiku报告。 I have added a Mondrian Data Source. 我添加了一个Mondrian数据源。 Now i would like to add two Rows in the report to show a Sum in the 3rd row, i did some R&D and found that we can use Cell formatter that can use Formula to use columns from the Schema XML. 现在我想在报告中添加两行以显示第三行中的Sum,我做了一些研发,发现我们可以使用Cell格式化程序,可以使用Formula来使用Schema XML中的列。 But i'm unable to get is exact source. 但我无法得到确切的消息来源。 Here is the source i found from Mondrian Documentation : 以下是我从Mondrian文档中找到的来源:

<CalculatedMember name="name" dimension="dimension">
<Formula>
[Measures].[Unit Sales] * 2
</Formula>
<CellFormatter>
<Script language="JavaScript">
var s = value.toString();
while (s.length() < 20) {
s = "0" + s;
}
return s;
</Script>
</CellFormatter>
</Measure>

But this seems incorrect and this the block i want as its use Formula tag and using [Measures].[Unit Sales] * 2 that is looking helpful for me. 但这似乎是不正确的,这个块我想要使用公式标签和使用[Measures].[Unit Sales] * 2看起来对我有帮助。

Can any one help me to correct this tag. 任何人都可以帮我纠正这个标签。

Here is the solution I found for the problem. 这是我找到的问题的解决方案。

<CalculatedMember name="Profit" dimension="Measures" formula="[Measures].[Store Sales] - [Measures].[Store Cost]">

        <CalculatedMemberProperty name="FORMAT_STRING" value="$#,##0.00"/>

</CalculatedMember>

Hope this would be helpful for anyone else. 希望这会对其他人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM