使用 MDX 计算按比例份额

发布于 2024-12-26 15:13:11 字数 392 浏览 4 评论 0原文

我有一个 SSAS 立方体,显示投资者及其在基金中的投资价值。基金价值和份额比例实际上是表格。我创建了一个计算指标,只需将基金价值乘以份额即可。问题出在 Total 行上。现在显示的是标记为“错误”的行。标记为 RIGHT 的行是我想要显示的内容。

Investor    Fund Value  Share   Investor Value
Investor 1  100,000     0.4     40,000
Investor 1  200,000     0.3     60,000
Total       300,000     0.7     210,000   <== WRONG
Total                           100,000   <== RIGHT

I have a SSAS cube that shows Investors and their investment value in funds. The fund value and prorata shares are in fact table. I've created a calculated measure that simply multiplies fund value * share. The problem comes in the Total line. The row marked as WRONG is what shows now. The row marked RIGHT is what I want to show.

Investor    Fund Value  Share   Investor Value
Investor 1  100,000     0.4     40,000
Investor 1  200,000     0.3     60,000
Total       300,000     0.7     210,000   <== WRONG
Total                           100,000   <== RIGHT

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

孤凫 2025-01-02 15:13:11

如果性能可能成为问题(预先计算),则最大答案是可行的方法。可以使用 MDX 计算成员来解决 prorarta(如果维度很大,性能可能会成为问题)。

进一步探讨此解决方案的问题是我需要一个维度,其中 100'000 和 200'000 基金价值存在差异(例如 [Share] 。)。你能描述一下你的尺寸吗?

Max answer is the way to go if performance might be a problem (precalculation). It's possible to solve the prorarta using MDX Calculated members (performance might be an issue if your dimensions are big).

The issue to go further into this solution is I need a dimension where the 100'000 and the 200'000 Fund Values are difference (e.g. [Share] .). Can you describe your dimensions ?

吖咩 2025-01-02 15:13:11

我知道这已经是几个月前的事了,但我会使用范围声明来用正确的计算覆盖该单元格。看看这个:http://www .bidn.com/articles/mdx-and-dmx/94/mdx-scripting-with-scope-statement 要查看文章需要登录,但免费。

I know this is a few months old, but I would use a scope statement to overwrite that cell with the correct calculation. Check this out: http://www.bidn.com/articles/mdx-and-dmx/94/mdx-scripting-with-scope-statement To view the article requires a login, but its free.

嗼ふ静 2025-01-02 15:13:11

最简单的方法:在olap DB的DSV(在相应的事实表中)中创建新的计算字段(编写表达式)。然后在度量中使用此字段(聚合类型 SUM)。

Simplest way: create new calculated field (write an expression) in DSV (in the corresponding fact table) of your olap DB. And after that use this field in the measure (aggregation type SUM).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文