如何在Mondrian MDX查询中查询两个日期之间的结果?

时间:2012-08-16 01:49:24

标签: mdx pentaho

  

可能重复:
  How to query in mdx between two dates where the date is not exist in the cube

我有一个关于查询MDX的问题,在2个日期之间记录,比如DateFrom和DateTo。

这是我的MDX查询(在pentaho中):

WITH 
    SET [metrics] AS ${myType}
    SET [dates] AS (

                    [Date].[${DateFrom,date,"yyyy"}].[${DateFrom,date,"M"}].[${DateFrom,date,"d"}]

        :

                    [Date].[${DateTo,date,"yyyy"}].[${DateTo,date,"M"}].[${DateTo,date,"d"}]                    

    )
SELECT  
     NON EMPTY [metrics] ON COLUMNS,
     NON EMPTY [dates] ON ROWS
FROM 
    ${ActivityList}

WHERE  
    ([Product].[${Product}],[Subscription].[${Subscription}], [Operator].[${Carrier}].[${Distributor}], [Instance].[${Instance}])

这里是mondrian xml文件部分:

<Dimension type="TimeDimension" highCardinality="false" name="Date">
      <Hierarchy hasAll="false">
        <Level name="Year" column="TS_YEAR" type="Numeric" uniqueMembers="false" levelType="TimeYears" hideMemberIf="Never">
        </Level>
        <Level name="Month" column="TS_MONTH" type="Numeric" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never">
        </Level>
        <Level name="Day" column="TS_DAY" type="Numeric" uniqueMembers="false" levelType="TimeDays" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>

当我在用户界面中选择DateFrom和DateTo时,即使有一些记录在db中记录了这两个日期,它也没有显示任何结果。 任何想法?

0 个答案:

没有答案