简体   繁体   English

相对日期过滤问题 Pentaho Workspace(Mondrian) AnalyzerDateFormat 周重叠两个月仅显示一周的开始日期

[英]Issue with relative date filtering Pentaho Workspace(Mondrian) AnalyzerDateFormat Week overlaps two Months only showing beginning days of the week

I have a table dimDate built correctly.我有一个正确构建的表 dimDate 。 I am using a surrogate key DC_tk('20211202') in my fact table to map to the primary key in dimDate CCYYMMDD('20211202') which correlates to date_tk in dimDate.我在事实表中使用代理键 DC_tk('20211202') 到 map 到 dimDate CCYYMMDD('20211202') 中的主键,它与 dimDate 中的 date_tk 相关。 The issue is that when the previous week is selected in the analyzer filter the month that is showing up in the Pentaho Analyzer is November and not December, in other words only the beginning days of the week.问题是当在分析器过滤器中选择前一周时,Pentaho 分析器中显示的月份是 11 月而不是 12 月,换句话说,只有一周的开始日期。 I suspect this is because week 49 overlaps Nov and Dec. If the Select from list filter value is set to week 49 then two lines of 49 are available to filter on.我怀疑这是因为第 49 周与 11 月和 12 月重叠。如果列表过滤器值中的 Select 设置为第 49 周,则可以过滤两行 49。 The code is as follows:代码如下:

<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>

How can I prevent this from happening while using Pentaho's built in relative date filtering?在使用 Pentaho 内置的相对日期过滤时如何防止这种情况发生? Any help on this issue is appreciated.对此问题的任何帮助表示赞赏。

I realized that since there are two values for month and this would skew the hierarchy.我意识到,因为月份有两个值,这会扭曲层次结构。 The recognized hierarchy is: 公认的层次结构是:

  • [yyyy] (Year) [yyyy](年)
  • [yyyy].[q] (Quarter) [yyyy].[q](季度)
  • [yyyy].[q].[M] (Month) [yyyy].[q].[M](月)
  • [yyyy].[q].[M].[w] (Week) [yyyy].[q].[M].[w](周)
  • [yyyy].[q].[M].[w].[yyyy-MM-dd] (Day) [yyyy].[q].[M].[w].[yyyy-MM-dd](日)

But this fails if a week is extended over two months.但是,如果将一周延长两个月以上,这将失败。

Modifying the hierarchy by switching the order of Month and Week to read as below will work:通过将月和周的顺序切换为如下所示来修改层次结构将起作用:

  • [yyyy] (Year) [yyyy](年)
  • [yyyy].[q] (Quarter) [yyyy].[q](季度)
  • [yyyy].[q].[w] (Week) [yyyy].[q].[w](周)
  • [yyyy].[q].[w].[M] (Month) [yyyy].[q].[w].[M](月)
  • [yyyy].[q].[w].[M].[yyyy-MM-dd] (Day) [yyyy].[q].[w].[M].[yyyy-MM-dd](日)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM