在多维数据集中的维度属性上定义 SUM 计算成员

发布于 2024-10-23 20:28:38 字数 699 浏览 1 评论 0原文

我是 OLAP/MDX 新手,所以如果这个问题太明显了,请原谅我。

我正在尝试定义一个 MDX 计算成员,它将对维度属性中的值求和,但无法这样做。我什至不确定这是否可能。

这是一个示例场景。

在数据仓库中,

想象一个 DiskDim 维度,它存储磁盘实例,并且具有一个 Size 列,该列存储每个磁盘的大小(以 MB 为单位)。

有一个 ComputerDim 维度,用于存储计算机实例。

有一个事实表ComputerHasDisk,它存储计算机实例和磁盘之间的关系。请注意,事实表只有关系,没有可用作度量的列。

在 AS 中,

我们有一个 DiskDim 维度、一个 Computer 维度和 ComputerHasDisk 的行计数度量、DiskDim 的行计数度量和 ComputerDim 的行计数度量。

我想将计算成员定义为总磁盘大小度量的一部分,以便使用计算成员我应该能够在计算机上进行切片并获取每台计算机的所有磁盘大小的总和。

这是我希望编写的查询:

SELECT [Measures].[TotalDiskSize] ON COLUMNS, [ComputerDim].[ComputerDim].行上的成员 FROM [Cube]

我们如何定义计算成员 [Measures].[TotalDiskSize] 才能编写上面的查询。有可能吗?

谢谢, 阿尼鲁德

I am an OLAP/MDX newbie so pardon me if this is too obvious of a question.

I am trying to define a MDX calculated member which will SUM the values from a dimension property but unable to do so. I am not even sure if this is possible or not.

This is an example scenario.

In the DataWarehouse

Imagine a DiskDim dimension which stores instances of disks and which has a column Size which stores the Size in MB’s of the each Disk.

There is a ComputerDim dimension which stores instances of computers.

There is a fact table ComputerHasDisk which stores the relationship between an instance of a computer and disk. Note the fact table only has the relationship and no columns which can be used as measures.

In AS

We have a DiskDim dimension, a Computer dimension and a count of rows measure for ComputerHasDisk, a count of rows measure for DiskDim and a count of rows measure for ComputerDim.

I want to define a calculated member as part of Measures for Total Disk Size such that using the calculated member I should be able to slice on Computer and get the sum of all the disk sizes for each Computer.

This is the query I am expecting to write:

SELECT [Measures].[TotalDiskSize] ON COLUMNS,
[ComputerDim].[ComputerDim].Members ON ROWS
FROM [Cube]

How do we define the calculated member [Measures].[TotalDiskSize] to be able to write the query above. Is it even possible ?

Thanks,
Anirudh

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

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

发布评论

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

评论(1

若言繁花未落 2024-10-30 20:28:38

如果您想对 Disk_Size 进行求和,那么它应该有一个关联的度量,而不仅仅是一个维度 - 您不能也不应该尝试计算维度。

您可以扩展事实表以包含此列,从而从中派生出度量吗?

If you want to SUM your Disk_Size, then it should have an associated Measure, and not just be a Dimension - you can't and shouldn't be attempting to calculate on dimensions.

Can you extend your fact table to include this column and thus derive a Measure from it?

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