如何在mondrian中添加级别到列结果MDX

时间:2014-09-24 21:04:08

标签: mdx mondrian

我有以下MDX创建的下表

SELECT
{
    [Measures].numTickets 
}ON COLUMNS,
{
Descendants(DateCreacion.Children, DateCreacion.Month) 
}ON ROWS
FROM tickets

enter image description here

问题是我想在numTickets中添加另一个列,但每次我向列添加一个维度时,我都会得到一个空列。

select {[Clinica].Children} ON COLUMNS,
  {Descendants([DateCreacion].Children, [DateCreacion.YQMD].[Month])} ON ROWS
from [tickets]

enter image description here

我如何显示与第一张图片相同的数据,但是以第二种格式显示?

<Schema name="New Schema1">
  <Cube name="tickets" visible="true" cache="true" enabled="true">
    <Table name="fact">
    </Table>
    <Dimension type="TimeDimension" visible="true" foreignKey="fecha_tickets_id" name="DateCreacion">
      <Hierarchy name="YQMD" visible="true" hasAll="true">
        <Table name="dim_fecha_creacion_tickets" alias="">
        </Table>
        <Level name="Year" visible="true" column="a&#241;o" type="Numeric" uniqueMembers="false" levelType="TimeYears">
        </Level>
        <Level name="Quarter" visible="true" column="cuarto" type="Numeric" uniqueMembers="false" levelType="TimeQuarters">
        </Level>
        <Level name="Month" visible="true" column="mes" type="Numeric" uniqueMembers="false" levelType="TimeMonths">
        </Level>
        <Level name="Day" visible="true" column="dia" type="Numeric" uniqueMembers="false" levelType="TimeDays">
          <Property name="date_iso" column="date_iso" type="Numeric">
          </Property>
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" visible="true" foreignKey="clinica_id" name="Clinica">
      <Hierarchy name="New Hierarchy 0" visible="true" hasAll="true">
        <Table name="dim_posicion" alias="">
        </Table>
        <Level name="Posicion" visible="true" column="sigla" type="String" uniqueMembers="false">
        </Level>
      </Hierarchy>
    </Dimension>
    <Measure name="numTickets" column="idTicket" datatype="Numeric" aggregator="count" visible="true">
    </Measure>
  </Cube>
</Schema>

1 个答案:

答案 0 :(得分:1)

[Clinica].Children添加到列时,您删除了这些度量。 您可能希望使用交叉连接来保留它们,可以使用MDX中的*运算符来声明:

select {[Clinica].Children} 
       *
       { [Measures].numTickets }
       ON COLUMNS,
...

select { [Measures].numTickets } 
       *
       {[Clinica].Children}
       ON COLUMNS,
...

取决于您想要查看的列的顺序。