我有一个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 encaisé-H始终为NULL,即使在应该有值的行上也是如此。
我不明白的是,为什么联盟第一部分的结果会受到第二部分发生的事情的影响。有人能给我解释一下吗?
发布于 2013-02-01 17:34:31
META :我在这个问题上下了很大的功夫,到目前为止,唯一的答案是对效果的描述,而不是VISUALTOTALS的内部工作。
发布于 2013-01-22 07:13:33
我不是SSAS专家;但我可以分享我使用icCube的经验;VisualTotal()正在改变层次结构的实际聚合方式,如果您在同一请求中多次调用此函数,这将变得非常奇怪,因为可能是不确定的(取决于求值顺序),并且很难理解。
https://stackoverflow.com/questions/14436991
复制相似问题