在 mondrian 上使用不同计数,但仍然出现重复

发布于 2025-01-15 14:54:52 字数 1468 浏览 3 评论 0原文

有疑问

我对 mondrian 我的事实表

customer | regionid | customertype | productsold
------------------------------------------------
A        | 1        | T1           | P1
A        | 1        | T1           | P2
A        | 1        | T1           | P3
B        | 2        | T1           | P1
B        | 2        | T1           | P2
C        | 1        | T2           | P1
C        | 1        | T2           | P2
C        | 1        | T2           | P3
C        | 1        | T2           | P4
... so on

地区 维度

regionid | state | district | subdistrict
-----------------------------------------

CustomerType 维度

customertype | name  | more column
----------------------------------

ProductSold 维度

productsold | name | more column
--------------------------------

每个客户都有 1 一对多关系,

地区和客户类型的一对一关系,以及与productsold我的MDX查询的

select 
{[Measures].[CustomerCount]} on columns,
{([Region].[AllRegion], [CustomerTypes].[AllCustomerTypes], 
[ProductSold].[AllProductSold])} on rows
from [Customers]

就像我为CustomerCount配置的不同计数 一样,但结果仍然是重复的。

<Measure name="CustomerCount" column="Customer" aggregator="distinct-count" visible="true">

任何建议表示赞赏。谢谢。

i have a question regarding mondrian

My facts table

customer | regionid | customertype | productsold
------------------------------------------------
A        | 1        | T1           | P1
A        | 1        | T1           | P2
A        | 1        | T1           | P3
B        | 2        | T1           | P1
B        | 2        | T1           | P2
C        | 1        | T2           | P1
C        | 1        | T2           | P2
C        | 1        | T2           | P3
C        | 1        | T2           | P4
... so on

Region dimension

regionid | state | district | subdistrict
-----------------------------------------

CustomerType dimension

customertype | name  | more column
----------------------------------

ProductSold dimension

productsold | name | more column
--------------------------------

Each customer have 1 to 1 relation with region and customertype, and 1 to many with productsold

my MDX query like

select 
{[Measures].[CustomerCount]} on columns,
{([Region].[AllRegion], [CustomerTypes].[AllCustomerTypes], 
[ProductSold].[AllProductSold])} on rows
from [Customers]

I configured distinct-count for CustomerCount, but still the result is duplicate.

<Measure name="CustomerCount" column="Customer" aggregator="distinct-count" visible="true">

Any advice appreciate. Thanks.

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

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

发布评论

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

评论(1

挖鼻大婶 2025-01-22 14:54:52

我希望您的 MDX 语句仅返回一个单元格(包含不同的计数 3),因为您的行轴​​包含每个维度的 All 成员。

我建议您在 Mondrian 中启用 SQL 日志记录并检查 Segment.load 查询,因为它应该是一个非常简单的 SQL 语句来返回不同的客户计数。

Mondrian 9.3 及更高版本使用 log4j2,因此请参阅此示例进行配置: https://github.com/pentaho/mondrian/blob/master/mondrian/src/it/resources/log4j2.xml

之前的版本Mondrian 仍然使用 log4j1.2 所以请参阅此示例进行配置:
https://github.com/ pentaho/mondrian/blob/9.1.0.0/mondrian/src/it/resources/log4j.xml

I would have expected your MDX statement to return just a single cell (containing the distinct count of 3) since your rows axis includes the All member from each dimension.

I would suggest you enable SQL logging in Mondrian and check the Segment.load query since it should be a pretty simple SQL statement to return the distinct count of Customers.

Mondrian 9.3 and onwards uses log4j2 so see this example for configuration: https://github.com/pentaho/mondrian/blob/master/mondrian/src/it/resources/log4j2.xml

Prior versions of Mondrian still use log4j1.2 so see this example for configuration:
https://github.com/pentaho/mondrian/blob/9.1.0.0/mondrian/src/it/resources/log4j.xml

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