MDX替换null - 获取维度范围

时间:2013-07-30 15:49:18

标签: null mdx

您好我有以下MDX查询:

select NON EMPTY {[Measures].[count_X]} ON 0,
NON EMPTY {[DIM_DAYS].Children} ON 1 
from [Cube]

使用以下结果集:

Axis #0:
{[DIM_S].[A], [DIM_LOCALIT].[X], [DIM_ANNO].[2013]}
Axis #1:
{[Measures].[count_X]}
Axis #2:
{[DIM_TEMPO_RILASCIO].[#null]}
{[DIM_TEMPO_RILASCIO].[0]}
{[DIM_TEMPO_RILASCIO].[1]}
{[DIM_TEMPO_RILASCIO].[2]}
{[DIM_TEMPO_RILASCIO].[3]}
{[DIM_TEMPO_RILASCIO].[4]}
{[DIM_TEMPO_RILASCIO].[5]}
{[DIM_TEMPO_RILASCIO].[6]}
{[DIM_TEMPO_RILASCIO].[7]}
{[DIM_TEMPO_RILASCIO].[8]}
{[DIM_TEMPO_RILASCIO].[9]}
{[DIM_TEMPO_RILASCIO].[10]}
Row #0: 468
Row #1: 69
Row #2: 70
Row #3: 53
Row #4: 90
Row #5: 77
Row #6: 78
Row #7: 119
Row #8: 159
Row #9: 155

我想: 1)使用NOT SPECIFIED更改#null标签 2)将日期范围设为[1 - 30] [31 - 60]

有人可以帮助我吗?致谢

1 个答案:

答案 0 :(得分:2)

with Member [DIM_TEMPO_RILASCIO].[NOT SPECIFIED] AS
            [DIM_TEMPO_RILASCIO].[#null]                       // just rename it
     Member [DIM_TEMPO_RILASCIO].[1-30] AS
            Aggregate( [DIM_TEMPO_RILASCIO].[1] : [DIM_TEMPO_RILASCIO].[30] )
     Member [DIM_TEMPO_RILASCIO].[31-60] AS
            Aggregate( [DIM_TEMPO_RILASCIO].[31] : [DIM_TEMPO_RILASCIO].[60] )
select NON EMPTY {[Measures].[count_X]} ON 0,
       NON EMPTY {
           [DIM_TEMPO_RILASCIO].[NOT SPECIFIED],
           [DIM_TEMPO_RILASCIO].[1-30],
           [DIM_TEMPO_RILASCIO].[31-60]
       } ON 1 
  from [Cube]

应该提供您在问题中说明的内容。但是,我不确定你为什么要遗漏[DIM_TEMPO_RILASCIO].[0]。我并没有详细介绍维度和层次结构名称,但也许您可以将我的解决方案转移到您的实际情况。