1
votes

I have 2 cubes (SalesCube and StockCube) with 2 shared dimensions: Shop name, Article Id. Each cube has it's own specific dimension: SalesCube has SalesDim and StockCube has StockDim. Also, each cube has it's own measure: SalesCube has "Sales value" and StockCube has "Stocks value".I created a virtual cube which contains all dimensions (2 shared and 2 specific) and both measures. The problem is that if I use a specific dimension the result will contain data only ofr the measure from the cube that has that specific dimension (the second measure is empty). If I use only shared dimensions, the report will bring results for both measures. What am I missing ?

Practically, virtual values are blank for measures under dimensions that do not come from the same parent cube

I found something similar but with no answers: http://forums.pentaho.com/showthread.php?130932-Virtual-Cube-Measure-Behaviour-Question

<Schema name="Shop_Sales_and_Stock">
  <Dimension name="SalesDim">
    <Hierarchy hasAll="true">
      <Table name="Sales" primaryKey="Article_Id"/>
      <Level name="SalesDim" uniqueMembers="false" column="SalesDim" type="String">
      </Level>
    </Hierarchy>
  </Dimension>
  <Dimension name="StockDim">
    <Hierarchy hasAll="true">
      <Table name="Stocks" primaryKey="Article_Id"/>
      <Level name="StockDim" uniqueMembers="false" column="StockDim" type="String">
      </Level>
    </Hierarchy>
  </Dimension>

<Cube name="SalesCube">
  <Table name="Sales"/>
  <Dimension name="Shop_name">
    <Hierarchy visible="true" hasAll="true">
      <Table name = "Sales"/>
    <Level name="Shop name" uniqueMembers="false" column="Shop_name" type="String">
    </Level>
      </Hierarchy>
  </Dimension>
  <Dimension name="Article Id">
    <Hierarchy visible="true" hasAll="true">
      <Table name = "Sales"/>
    <Level name="Article Id" uniqueMembers="false" column="Article_Id" type="String">
    </Level>
      </Hierarchy>
  </Dimension>
    <DimensionUsage name="SalesDim" source="SalesDim" foreignKey="Article_Id"/>
    <Measure name="Sales value" column="Sales value" aggregator="sum" formatString="&#x23;"/>
</Cube>

<Cube name="StockCube">
  <Table name="Stocks"/>
  <Dimension name="Shop_name">
    <Hierarchy visible="true" hasAll="true">
      <Table name = "Stocks"/>
    <Level name="Shop name" uniqueMembers="false" column="Shop_name" type="String">
    </Level>
      </Hierarchy>
  </Dimension>
  <Dimension name="Article Id">
    <Hierarchy visible="true" hasAll="true">
      <Table name = "Stocks"/>
    <Level name="Article Id" uniqueMembers="false" column="Article_Id" type="String">
    </Level>
      </Hierarchy>
  </Dimension>
    <DimensionUsage name="StockDim" source="StockDim" foreignKey="Article_Id"/>
    <Measure name="Stocks value" column="Stocks value" aggregator="sum" formatString="&#x23;"/>
</Cube>

<VirtualCube name="Shop_Sales_and_Stock">
    <CubeUsages>
        <CubeUsage cubeName="SalesCube"/>
        <CubeUsage cubeName="StockCube"/>
    </CubeUsages>
    <VirtualCubeDimension name="Shop name"/>
    <VirtualCubeDimension name="Article Id"/>
    <VirtualCubeMeasure cubeName="SalesCube" name="[Measures].[Sales value]"/>
    <VirtualCubeMeasure cubeName="StockCube" name="[Measures].[Stocks value]"/>
</VirtualCube>
</Schema>
2

2 Answers

0
votes

Use ignoreUnrelatedDimensions parameter on cube-specific dimensions (dimensions not shared by all cubes within a virtual cube). Read more about this parameter in Mondrian Schema documentation.

<VirtualCube name="Shop_Sales_and_Stock">
  <CubeUsages>
    <CubeUsage cubeName="SalesCube" ignoreUnrelatedDimensions="true"/>
    <CubeUsage cubeName="StockCube" ignoreUnrelatedDimensions="true"/>
  </CubeUsages>
  <VirtualCubeDimension name="Shop name"/>
  <VirtualCubeDimension name="Article Id"/>
  <VirtualCubeMeasure cubeName="SalesCube" name="[Measures].[Sales value]"/>
<VirtualCubeMeasure cubeName="StockCube" name="[Measures].[Stocks value]"/>

0
votes

The behaviour you described is completely normal and expected. OLAP has no idea how to calculate [Measures].[Sales value] if you ask it to segment it by Article Id dimension. It just makes no sense. You can't know which facts (records/rows) from the Sales table to get for each Article Id value.

If you want to analyse both measures separately - use two separate cubes or accept the fact that when you segment by not-shared dimension you'll get only one measure

If you want to calculate another measure based on the two from two different cubes - you can only use common dimensions shared between them. If you think about it, other calculations would make no sense anyway.