【发布时间】:2016-10-07 08:56:07
【问题描述】:
我的 2 个 MDX 语句有问题,第一个给出正确的结果,但第二个与预期不同。
由于 MDX 是动态构建的,我宁愿使用第二个。
create calculated member [Sejours Ambulatoire] as sum([Ambu].[Ambu].[Ambu].[Ambulatoire], NbSejours)
create calculated member [Taux Ambulatoire] as IIF( [Ambu].[Ambu].current is [Ambu].[Ambu].[Non Ambulatoire], 0, divN([Sejours Ambulatoire], [Measures].[NbSejours] , 0) ), format_string='percent'
第一个代码:
select [Measures].[Taux Ambulatoire] on 0
from [Cube]
where {[Ambu].[Ambu].[Non Ambulatoire]} * {[Etablissement].[Lieu établissement].[All-M].&[CHU de Brest]} * { [Periode].[Periode].[All-M].&[2014] }
-- 结果 0,00% 正确
第二个代码:
SELECT
{ [Measures].[Taux Ambulatoire] } ON 0
FROM ( SELECT
{ [Periode].[Periode].[All-M].&[2014] } ON 0,
{ [Etablissement].[Lieu établissement].[All-M].&[CHU de Brest] } ON 1,
{ [Ambu].[Ambu].[Non Ambulatoire] } ON 2
FROM [Cube])
-- 结果 120,86% 不正确
有人能解释一下区别吗?
【问题讨论】:
-
我将在这个周末回答,这是 MDX 的复杂性之一,被覆盖的层次结构。需要一些时间才能使用,在其中定义元组,更改它们的计算方式。您也可以尝试 where 选项,它更接近第一个版本