我在 Microsoft Adventure Work DW 2012 上使用 MDX 查询,我想要" SUM" "经销商订单计数"在每个"国家" 中的"产品"经销商订单计数"在"澳大利亚"
中超过30岁换句话说,
首先,我想找到"产品"有"经销商订单计数" > 30
在"澳大利亚" 然后找到" SUM" "经销商订单计数" 在其他国家/地区发布的"产品&#34>
措施是
[措施]。[经销商订单计数]
和维度
[地理学]。[国家] [国家]
和
[产品]。[产品]。[产品]
全部感谢@}; -
答案 0 :(得分:0)
试试:
With
Member [Measures].[AustraliaProducts] as
SUM(
[Product].[Product].[Product].Members,
IIF(
([Geography].[Country].&[Australia],[Measures].[Reseller Order Count]) > 30,
[Measures].[Reseller Order Count],
Null
)
)
Select
[Measures].[AustraliaProducts] on 0,
Non Empty [Geography].[Country].[Country].Members on 1
From [Adventure Work]
答案 1 :(得分:0)
我认为您需要在WITH
子句中执行ozzy过滤器,然后在SELECT
中使用它:
WITH
SET [AustraliaProducts] AS
FILTER(
[Product].[Product].[Product].Members,
([Geography].[Country].&[Australia],[Measures].[Reseller Order Count]) > 30
)
SELECT
[Measures].[Reseller Order Count] ON 0,
Non Empty
[Geography].[Country].[Country].MEMBERS
* [AustraliaProducts] ON 1
FROM [Adventure Work];
我有点不确定你是否在结果中需要澳大利亚 - 如果没有,那么在WITH条款中的进一步添加可以过滤掉澳大利亚:
WITH
SET [AustraliaProducts] AS
FILTER(
[Product].[Product].[Product].Members,
([Geography].[Country].&[Australia],[Measures].[Reseller Order Count]) > 30
)
SET [exclAustralia] AS
EXCEPT(
[Geography].[Country].[Country].MEMBERS,
[Geography].[Country].&[Australia]
)
SELECT
[Measures].[Reseller Order Count] ON 0,
Non Empty
[exclAustralia]
* [AustraliaProducts] ON 1
FROM [Adventure Work];