[英]Issue with relative date filtering Pentaho Workspace(Mondrian) AnalyzerDateFormat Week overlaps two Months only showing beginning days of the week
我有一个正确构建的表 dimDate 。 我在事实表中使用代理键 DC_tk('20211202') 到 map 到 dimDate CCYYMMDD('20211202') 中的主键,它与 dimDate 中的 date_tk 相关。 问题是当在分析器过滤器中选择前一周时,Pentaho 分析器中显示的月份是 11 月而不是 12 月,换句话说,只有一周的开始日期。 我怀疑这是因为第 49 周与 11 月和 12 月重叠。如果列表过滤器值中的 Select 设置为第 49 周,则可以过滤两行 49。 代码如下:
<Dimension type="TimeDimension" visible="true" highCardinality="false" name="EXCREATEDDATE">
<Hierarchy name="Created Date" visible="true" hasAll="true" primaryKey="date_tk">
<Table name="DimDate" schema="dbo">
</Table>
<Level name="Created Year" visible="true" column="YEAR" type="String" uniqueMembers="true" levelType="TimeYears" hideMemberIf="Never">
<Annotations>
<Annotation name="AnalyzerDateFormat">
<![CDATA[[yyyy]]]>
</Annotation>
</Annotations>
</Level>
<Level name="Created Month" visible="true" column="MONTH" type="String" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never" captionColumn="month_short_desc">
<Annotations>
<Annotation name="AnalyzerDateFormat">
<![CDATA[[yyyy].[M]]]>
</Annotation>
</Annotations>
</Level>
<Level name="Created Week" visible="true" column="week_of_year" type="String" uniqueMembers="false" levelType="TimeWeeks" hideMemberIf="Never">
<Annotations>
<Annotation name="AnalyzerDateFormat">
<![CDATA[[yyyy].[M].[w]]]>
</Annotation>
</Annotations>
</Level>
<Level name="Created Day" visible="true" column="day_of_month" type="String" uniqueMembers="false" levelType="TimeDays" hideMemberIf="Never">
<Annotations>
<Annotation name="AnalyzerDateFormat">
<![CDATA[[yyyy].[M].[w].[d]]]>
</Annotation>
</Annotations>
</Level>
<Level name="Created Date" visible="true" column="DateCCYYMMDD" type="String" uniqueMembers="false" levelType="TimeDays" hideMemberIf="Never">
<Annotations>
<Annotation name="AnalyzerDateFormat">
<![CDATA[[yyyy].[M].[w].[d].[yyyyMMdd]]]>
</Annotation>
</Annotations>
</Level>
</Hierarchy>
<DimensionUsage source="EXCREATEDDATE" name="EXCREATEDDATE" visible="true" foreignKey="DC_tk" highCardinality="false"></DimensionUsage>
在使用 Pentaho 内置的相对日期过滤时如何防止这种情况发生? 对此问题的任何帮助表示赞赏。
我意识到,因为月份有两个值,这会扭曲层次结构。 公认的层次结构是:
但是,如果将一周延长两个月以上,这将失败。
通过将月和周的顺序切换为如下所示来修改层次结构将起作用:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.