-1

由于我没有编程背景,因此我将尽可能使这个问题和场景变得基本。如何制作一个所有红色乘以 5、黄色乘以 6、蓝色乘以 7 的脚本?新措施将总计汇总。我不知道该用什么表达方式。只需使用 [Product] 作为颜色,使用 [Measure] 作为数量。

在此处输入图像描述

我还不明白 MEMBERS 和其他表达方式的使用,因为这是我第一次使用它。我试过了

([测量].[数量],[产品].&[黄色])*6

但它只会将所有内容乘以 6。也许过滤器?国际金融协会?我只是不知道怎么做。当我将它应用到我们的数据库中时,该脚本会有很长的路要走。谢谢!

4

1 回答 1

0

我知道你问过关于用 excel 做这件事,但是如果你正在编写一个 MDX 查询,你可以创建一个新的度量值并像这样运行查询:

WITH 

member measures.[ColorQuantity] AS CASE WHEN [Product].[Product].currentmember.member_key = "Yellow" THEN measures.[Quantity] * 6
                             WHEN [Product].[Product].currentmember.member_key = "Blue" THEN measures.[Quantity] * 5
                              WHEN [Product].[Product].currentmember.member_key = "Red" THEN measures.[Quantity] * 2
                             ELSE  measures.[Quantity] END

SELECT {
measures.[Quantity], measures.[ColorQuantity]
} ON 0,
Non EMPTY 
{
[Product].[Product].[All].Children  /// I dont know the FULL dimension AND hierarchy path you want TO use
} ON 1
FROM YourCubeName

这可能会帮助您入门。

于 2018-10-05T01:52:55.317 回答