蒙德里安:总和聚合器给出意想不到的结果

时间:2013-08-16 04:08:53

标签: mondrian

我有一个包含以下措施的立方体:

<Measure name="NbrSecrets" column="isSecret" aggregator="sum"/> <Measure name="Montant du contrat" column="montantcontrat" aggregator="sum" formatString="$#,##0" />

列&#39; isSecret是0或1(postgres中的int类型)

以下查询返回列/度量NbrSecrets的总和为零, 它的行为与Montant du contrat&#39;的行为不同,它正确地对值进行求和 在事实表中。结果就好像事实表的isSecret列包含所有行的0,我知道许多行都有isSecret = 1。

SELECT
NON EMPTY 
 {Hierarchize({[Time].[Year].Members})} 
 ON COLUMNS,
NON EMPTY 
 {Hierarchize({
    [Measures].[NbrSecrets], 
    [Measures].[Montant du contrat]})} 
 ON ROWS
FROM [Contrats]
Axis #0:
{}
Axis #1:
{[Time].[2000]}
{[Time].[2001]}
{[Time].[2003]}
{[Time].[2004]}
{[Time].[2005]}
{[Time].[2006]}
{[Time].[2007]}
{[Time].[2008]}
{[Time].[2009]}
{[Time].[2010]}
{[Time].[2011]}
{[Time].[2012]}
{[Time].[2013]}
Axis #2:
{[Measures].[Montant du contrat]}
{[Measures].[NbrSecrets]}
Row #0: $24,906
Row #0: $798,634
Row #0: $8,381
Row #0: $56,281
Row #0: $1,683,772
Row #0: $614,878
Row #0: $4,983,809
Row #0: $409,447,717
Row #0: $7,769,408,600
Row #0: $7,451,808,764
Row #0: $10,240,167,750
Row #0: $12,675,764,184
Row #0: $2,328,797,494
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0
Row #1: 0

这个MDX似乎与之前的结果相矛盾(isSecret在这种情况下返回正确的总和):

SELECT NON EMPTY CrossJoin([Transparence (montant des contrats secrets ou non)].[Montant secrets].Members, [Time].[Year].Members) ON COLUMNS, NON EMPTY {Hierarchize({[Measures].[NbrSecrets]})} ON ROWS FROM [Contrats]

结果:

Axis #0:
{}
Axis #1:
{[InterneOuExterne].[false], [Time].[2000]}
{[InterneOuExterne].[false], [Time].[2001]}
{[InterneOuExterne].[false], [Time].[2003]}
{[InterneOuExterne].[false], [Time].[2004]}
{[InterneOuExterne].[false], [Time].[2005]}
{[InterneOuExterne].[false], [Time].[2006]}
{[InterneOuExterne].[false], [Time].[2007]}
{[InterneOuExterne].[false], [Time].[2008]}
{[InterneOuExterne].[false], [Time].[2009]}
{[InterneOuExterne].[false], [Time].[2010]}
{[InterneOuExterne].[false], [Time].[2011]}
{[InterneOuExterne].[false], [Time].[2012]}
{[InterneOuExterne].[false], [Time].[2013]}
{[InterneOuExterne].[true], [Time].[2001]}
{[InterneOuExterne].[true], [Time].[2008]}
{[InterneOuExterne].[true], [Time].[2009]}
{[InterneOuExterne].[true], [Time].[2010]}
{[InterneOuExterne].[true], [Time].[2011]}
{[InterneOuExterne].[true], [Time].[2012]}
{[InterneOuExterne].[true], [Time].[2013]}
Axis #2:
{[Measures].[NbrSecrets]}
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 0
Row #0: 1
Row #0: 14
Row #0: 336
Row #0: 486
Row #0: 1,227
Row #0: 1,736
Row #0: 412

0 个答案:

没有答案