我对 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,即使在应该有值的行上也是如此。
我不明白为什么工会第一部分的结果会受到第二部分发生的事情的影响。有人可以向我解释一下吗?