我正在尝试扩展简单 TimeDimension 的 Pentaho 示例以按星期几聚合
这是提供的示例:
<Dimension name="Time" type="TimeDimension">
<Hierarchy hasAll="true" allMemberName="All Periods" primaryKey="dateid">
<Table name="datehierarchy"/>
<Level name="Year" column="year" uniqueMembers="true" levelType="TimeYears" type="Numeric"/>
<Level name="Quarter" column="quarter" uniqueMembers="false" levelType="TimeQuarters"/>
<Level name="Month" column="month" uniqueMembers="false" ordinalColumn="month" nameColumn="month_name" levelType="TimeMonths" type="Numeric"/>
<Level name="Week" column="week_in_month" uniqueMembers="false" levelType="TimeWeeks"/>
<Level name="Day" column="day_in_month" uniqueMembers="false" ordinalColumn="day_in_month" nameColumn="day_name" levelType="TimeDays" type="Numeric"/>
</Hierarchy>
</Dimension>
(参考这里)
我修改后的 Dimension 如下所示:
<Dimension name="Time" type="TimeDimension">
<Hierarchy hasAll="true" allMemberName="All Periods" primaryKey="date_id">
<Table name="dates"/>
<Level name="Year" column="year" uniqueMembers="true" levelType="TimeYears" type="Numeric"/>
<Level name="Month" column="month" uniqueMembers="false" ordinalColumn="month" nameColumn="month" levelType="TimeMonths" type="Numeric"/>
<Level name="Week" column="week" uniqueMembers="false" levelType="TimeWeeks"/>
<Level name="Day" column="day" uniqueMembers="true" ordinalColumn="day_in_week" nameColumn="day_of_week" levelType="TimeDays" type="Numeric"/>
</Hierarchy>
</Dimension>
我遇到了一个挑战,Saiku(用作蒙德里安立方体的前端)坚持认为我的Day
专栏应该始终基于年-月-周的层次结构,这显然适合向下钻取,但如果我只想要聚合则不行按天计算(例如星期一与星期二的平均销售额)。我尝试添加另一个维度,但无论我做什么,我最终都会得到 N * 天名称记录,其中 N 是我拥有的记录数(理想情况下,我会根据相关度量返回 7 行)