MDX查询10个数量以上的行的总卖价。

问题描述 投票:0回答:1

我需要有一个超过10个数量的行的总销售价格。

下面的查询结果是总的销售价格。

SELECT {[Sell Price]} ON COLUMNS
FROM SALES

我必须用条件([Sell Quantity] > 10)来过滤上面的查询。

[Customer].[Customer Name].[Customer Name]
[Goods].[Goods Name].[Goods Name]

先谢谢你

编辑 示例数据如图所示

Customer       Goods       Quantity     Price
-------------------------------------------------
A              X            2            1000
B              X            15           2000
C              Y            20           3000
C              X            3            6000

顾客和货物是尺寸。我需要第二行和第三行的总价格,因为这两行的数量超过了10。

我的预期结果是 5000.

sql sql-server ssas mdx
1个回答
1
投票

你需要使用过滤功能。基于上面分享的模式,你的查询将是

Select 
{
[Sell Price]
}on columns 
from yourCube
where 
{filter(
    ([Customer].[Customer Name].[Customer Name],[Goods].[Goods Name].[Goods Name]),
    [Sell Quantity] > 10)}
© www.soinside.com 2019 - 2024. All rights reserved.