首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MDX中的VISUALTOTALS和UNION不一致

MDX中的VISUALTOTALS和UNION不一致
EN

Stack Overflow用户
提问于 2013-01-21 18:49:23
回答 2查看 388关注 0票数 2

我有一个MDX请求的问题:

下面的查询给出了很好的部分结果

代码语言:javascript
复制
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的第一部分返回的行数比第一个查询少,这让我感到困惑

代码语言:javascript
复制
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,即使在应该有值的行上也是如此。

我不明白的是,为什么联盟第一部分的结果会受到第二部分发生的事情的影响。有人能给我解释一下吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-02-01 17:34:31

META :我在这个问题上下了很大的功夫,到目前为止,唯一的答案是对效果的描述,而不是VISUALTOTALS的内部工作。

票数 0
EN

Stack Overflow用户

发布于 2013-01-22 07:13:33

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14436991

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档