2

我对 MDX 请求有疑问:

以下查询给了我很好的部分结果

WITH 
 SET  [Paiments Encaisse] AS    { [Type Paiement].[Type Paiement Id].&[13]
    ,[Type Paiement].[Type Paiement Id].&[20]
    ,[Type Paiement].[Type Paiement Id].&[31]
    ,[Type Paiement].[Type Paiement Id].&[62]} 
MEMBER [Measures].[CA Encaissé]
AS
    SUM(
     [Paiments Encaisse],[Measures].[Montant HT Partage Encaisse]
    )
MEMBER Measures.[CA Encaissé-E] AS [Measures].[CA Encaissé]
MEMBER MEASURES.[CA Encaissé-H] AS 
([Measures].[CA Encaissé],[Hors En CDP].[Hors ou En CDP].&[False] )

SELECT 
{Measures.[CA Encaissé-E],MEASURES.[CA Encaissé-H]} ON 0,
NON EMPTY{ 
{[Hors En CDP].[Hors ou En CDP].&[True]} * VISUALTOTALS([Employes].[Hie Societe].MEMBERS)*
[CDP Propriétaire].[Centre de Profits].[All]

} ON 1
FROM NON VISUAL
( SELECT {[Employes].[Societe].&[1234]} ON 0,{[CDP Propriétaire].[Societe].&[1234]} ON 1 FROM [Prévisions] )
WHERE (
[Type Fantome].[Val].&[False],
[Date Facturation du Paiement].[Year].&[2011-01-01T00:00:00],
[Date Paiement].[Year].&[2011-01-01T00:00:00],
[Date Facturation Opération].[Year].&[2011-01-01T00:00:00])

但是,旨在为我提供整个结果的以下查询在 UNION 的第一部分返回的行数少于第一个查询,这让我感到困惑

WITH 
 SET  [Paiments Encaisse] AS    { [Type Paiement].[Type Paiement Id].&[13]
    ,[Type Paiement].[Type Paiement Id].&[20]
    ,[Type Paiement].[Type Paiement Id].&[31]
    ,[Type Paiement].[Type Paiement Id].&[62]} 
MEMBER [Measures].[CA Encaissé]
AS
    SUM(
     [Paiments Encaisse],[Measures].[Montant HT Partage Encaisse]
    )
MEMBER Measures.[CA Encaissé-E] AS [Measures].[CA Encaissé]
MEMBER MEASURES.[CA Encaissé-H] AS 
([Measures].[CA Encaissé],[Hors En CDP].[Hors ou En CDP].&[False] )

SELECT 
{Measures.[CA Encaissé-E],MEASURES.[CA Encaissé-H]} ON 0,
NON EMPTY{ UNION
({[Hors En CDP].[Hors ou En CDP].&[True]} * VISUALTOTALS([Employes].[Hie Societe].MEMBERS)*
[CDP Propriétaire].[Centre de Profits].[All]
 , {[Hors en CDP].[Hors ou En CDP].&[False],[Hors en CDP].[Hors ou En CDP].[All]}
*  {[Employes].[Hie Societe].[All]} * 
       VISUALTOTALS  ([CDP Propriétaire].[Centre de Profits].ALLMEMBERS
  ),ALL
)} ON 1
FROM NON VISUAL
( SELECT {[Employes].[Societe].&[1234]} ON 0,{[CDP Propriétaire].[Societe].&[1234]} ON 1 FROM [Prévisions] )
WHERE (
[Type Fantome].[Val].&[False],
[Date Facturation du Paiement].[Year].&[2011-01-01T00:00:00],
[Date Paiement].[Year].&[2011-01-01T00:00:00],
[Date Facturation Opération].[Year].&[2011-01-01T00:00:00])

此外,在第二个查询中,Measures.[CA Encaissé-H] 列始终为 NULL,即使在应该有值的行上也是如此。

我不明白为什么工会第一部分的结果会受到第二部分发生的事情的影响。有人可以向我解释一下吗?

4

2 回答 2

1

我不是 SSAS 的专家;但我可以分享我对icCube的经验;VisualTotal() 正在改变层次结构的实际聚合方式,如果您多次调用此函数到同一个请求中,这会变得非常奇怪,因为可能是不确定的(取决于评估顺序)并且难以理解。

于 2013-01-21T23:13:32.560 回答
0

META:我为这个问题附加了一个很大的赏金,到目前为止,唯一的答案是对效果的描述,而不是 VISUALTOTALS 的内部工作。

于 2013-02-01T09:34:31.120 回答