mdxolapolap-cubemondrianmdx-query

Mondrian MDX Query error:- All arguments to function '{}' must have same hierarchy


I am using Tibco Jaspersoft to generate the report.

Expected result:- enter image description here

Created Schema File:

    <Schema name="Telemetry Count Schema">
  <Cube name="Telemetry Count Cube" cache="true" enabled="true">
    <Table name="device_telementry">
    </Table>
    <Dimension type="StandardDimension" foreignKey="companyId" name="Tenant">
      <Hierarchy hasAll="true" allMemberName="All Tenant" primaryKey="id">
        <Table name="device">
        </Table>
        <Level name="Tenant Level " column="name" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" foreignKey="subscriptionId" name="Subscription">
      <Hierarchy hasAll="true" allMemberName="All Subscription" primaryKey="id">
        <Table name="subscription">
        </Table>
        <Level name="Subscription Level" column="name" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" foreignKey="applicationId" name="Application">
      <Hierarchy hasAll="true" allMemberName="All Application" primaryKey="id">
        <Table name="application">
        </Table>
        <Level name="Application Level" column="name" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" foreignKey="gatewayId" name="Gateway">
      <Hierarchy hasAll="true" allMemberName="All Gateway" primaryKey="id">
        <Table name="gateway">
        </Table>
        <Level name="Gateway Level" column="name" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>  
    </Dimension>
    <Dimension type="StandardDimension" foreignKey="deviceId" name="Device">
      <Hierarchy hasAll="true" allMemberName="All Device" primaryKey="id">
        <Table name="device">
        </Table>
        <Level name="Device Level" column="name" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Measure name="Telemetry Count" column="telemetry_count" aggregator="sum" visible="true">
    </Measure>
    <Measure name="Telemetry Item Count" column="telemetry_item_count" aggregator="count" visible="true">
    </Measure>
  </Cube>
</Schema>

MDX Query:-

select {[Measures].[Telemetry Count], [Measures].[Telemetry Item Count]} ON COLUMNS, {[Gateway].[All Gateway], [Gateway].[All Gateway].Children, [Device].[All Device], [Device].[All Device].Children} ON ROWS from [Telemetry Count Cube]

Error Message:

Mondrian Error: All arguments to function '{}' must have same hierarchy.

What am I doing wrong here?


Solution

  • Resultant MDX Query:-

    select {[Measures].[Telemetry Count], [Measures].[Telemetry Item Count]} ON COLUMNS,
      NON EMPTY 
    { CrossJoin ( {([Application].members)}, {CrossJoin ( {([Gateway].members)}, {([Device].members)} ) }) } 
    ON ROWS
    from [Telemetry Count Cube]