Pentaho Mondrian MDX - 删除父级游戏

时间:2016-02-15 10:06:04

标签: mdx pentaho mondrian

我是Pentaho,Mondrian和他的新手。 MDX。我开始使用Pentaho CE 5.0.1作为我的OLAP工具。我正在努力解决MDX查询问题,并希望有人能就我的问题给出一些指示。

我有以下时间维度蒙德里亚模式:

`<!-- date dimension -->
<Dimension name="Time" type="TimeDimension">
    <!-- Year, Quarter, Month, Week, Day -->        
    <Hierarchy name="YQMD" hasAll="true" allMemberName="All Dates" primaryKey="date_key" type="TimeDimension">
        <Table name="dim_date" schema="webportal"/>
        <Level name="Year" uniqueMembers="true" column="year4" levelType="TimeYears" type="Numeric"></Level>            
        <Level name="Quarter" uniqueMembers="false" column="quarter_name" levelType="TimeQuarters" type="String"></Level>
        <Level name="Month" uniqueMembers="false" column="month_number" ordinalColumn="month_number" nameColumn="month_number" levelType="TimeMonths" type="Numeric"></Level>
        <Level name="Week" column="week_in_month" uniqueMembers="false" levelType="TimeWeeks"></Level>
        <Level name="Day" column="day_in_month" uniqueMembers="false" ordinalColumn="day_in_month" nameColumn="day_in_month" levelType="TimeDays" type="Numeric"></Level>

    </Hierarchy>
</Dimension>`

我正在运行此MDX查询:

WITH 

MEMBER [Measures].[YTD] AS 'SUM(YTD(), [Measures].[Quotation Status])'

SELECT

NON EMPTY {[Measures].[Quotation Status], [Measures].[YTD]} ON COLUMNS,

NON EMPTY {
            {[Time.YQMD].[Year].Members},
            [Time.YQMD].[Month].Members
          } ON ROWS 

FROM [Broker Portal]

MDX查询有效并返回以下数据:

enter image description here

我的问题是:

如何在MDX中删除包含2015,2016的前两行?

如何删除2016年第03-12个月的行?

1 个答案:

答案 0 :(得分:0)

我怀疑以下内容可能朝着正确的方向前进:

WITH 
  MEMBER [Measures].[YTD] AS 
    Sum
    (
      YTD()
     ,[Measures].[Quotation Status]
    ) 
SELECT 
  NON EMPTY 
    {
      [Measures].[Quotation Status]
     ,[Measures].[YTD]
    } ON COLUMNS
 ,NON EMPTY 
    [Time.YQMD].[Year].MEMBERS 
  * [Time.YQMD].[Month].[Month].MEMBERS HAVING 
  [Measures].[Quotation Status] > 0 ON ROWS
FROM [Broker Portal];