0

I want mondrian to rollup as per my dimension table. For example

fact_table(id int, dim_id)

  • 1 2
  • 2 2
  • 3 1
  • 4 3

dimension_table( dim_id, value)

  • 1 first_value
  • 2 second_value

The last value in fact_table is delibrately not in the list of dimensions

<Cube name="BYT">
         <Dimension type="StandardDimension" visible="true" 
                   highCardinality="false" name="d1">
    <Hierarchy name="dimension_table" visible="true" hasAll="true">
      <Table name="dimension_table">
      </Table>
      <Level name="dimension" visible="true" column="dim_id" 
            type="String" uniqueMembers="false" levelType="Regular" 
                  hideMemberIf="Never">
      </Level>
    </Hierarchy>
  </Dimension>
     <Measure name="m1"  column="id"  datatype="Integer" 
           aggregator="count" visible="true">
    </Measure>
    <Cube>

when i fire the following query

select [Measure].[m1] on columns, {([d1])} on rows from [BYT]

The result is

 - Dimension  Measure
 - All D1     4

What i would like mondrian to do is something like this

- Dimension  Measure
- All D1     3

i.e. count only on the values included in the dimension table

Please suggest a solution. I read through the rollup policy in the documentation but that does not help my case.

Dogoferis
  • 628
  • 7
  • 23
jaipster
  • 11,967
  • 2
  • 21
  • 24

2 Answers2

0

If I understand you well, there is mistake in your cube xml. You should put distinct count instead of count.

<Measure name="m1"  column="id"  datatype="Integer" 
       aggregator="distinct count" visible="true">
</Measure>

Hope this helps.

fenix
  • 1,716
  • 2
  • 20
  • 26
0

You need to use a NON EMPTY context, which will result in a join with your fact table.

select [Measure].[m1] on columns, NON EMPTY {([d1])} on rows from [BYT]
Luc
  • 672
  • 3
  • 8