与mondrian和olap4j的日期范围查询

时间:2012-10-28 10:03:44

标签: olap-cube mondrian rolap olap4j

我正在使用olap4j来查询mondrian多维数据集。我在架构xml中定义了一个标准的TimeDimension:

    <Dimension name="DateTime" type="TimeDimension">
    <Hierarchy hasAll="true" primaryKey="DateId">
        <Table name="event_date" />
        <Level name="Year" column="Year" type="Numeric" uniqueMembers="true" levelType="TimeYears" />
        <Level name="Quarter" column="Quarter" captionColumn="QuarterLabel" uniqueMembers="false" levelType="TimeQuarters" />
        <Level name="Month" column="Month" captionColumn="MonthLabel" uniqueMembers="false" type="Numeric" levelType="TimeMonths" />
        <Level name="Week" column="Week" uniqueMembers="false" levelType="TimeWeeks" />
        <Level name="Day" column="Day" uniqueMembers="false" type="Numeric" levelType="TimeDays">
            <Property name="DayISO" column="DateIso" dependsOnLevelValue="true" />
            <Property name="DayOfWeek" column="DayOfWeek" dependsOnLevelValue="true" />
        </Level>
    </Hierarchy>
</Dimension>

我无法理解的是如何使用olap4j查询将DateTime作为共享维度的多维数据集上的日期范围。

有没有人有任何可以分享的例子?

Yosi

1 个答案:

答案 0 :(得分:1)

在MDX中,您可以按以下日期对结果进行切片:

select
    (...)
where
    ([DateTime].[Month].[2] : [DateTime].[Month].[6])