Pentaho Mondrian using aggregate tables -
i have xml schema description pentaho mondrian. looks this:
<dimension foreignkey="dt" name="dt" type="timedimension"> <hierarchy allmembername="all" hasall="true" name="hierarchy" primarykey="dt" visible="true"> <view alias="dt_view"> <sql dialect="generic">select distinct "dt",date_part('year', "dt")::integer year, date_part('month', "dt")::integer month, date_part('day', "dt")::integer day "world_steel_production"."world_steel_production_data" </sql> </view> <level captioncolumn="year" column="year" hidememberif="never" leveltype="timeyears" name="years" type="integer" uniquemembers="false"/> <level column="month" formatter="capsidea.membermonthformatter" hidememberif="never" leveltype="timemonths" name="month" type="integer" uniquemembers="false"/> </hierarchy> </dimension> <dimension foreignkey="obj" name="index"> <hierarchy allmembername="all" hasall="true" name="name_ru" primarykey="key" visible="true"> <table name="world_steel_production_dict_obj" schema="world_steel_production"/> <level column="key" namecolumn="name_ru" parentcolumn="parent_key" hidememberif="never" leveltype="regular" name="level" type="integer" uniquemembers="true"/> </hierarchy> </dimension> <measure aggregator="sum" column="vl" name="value" visible="true"/> </cube> our timedimension <dimension foreignkey="dt" name="dt" type="timedimension"> contains 2 levels: "year" , "month" when choose level "year" mondrian aggregates data year.
it seems fine, table world_steel_production_data has 2 dynamic levels in data defines columns dl (1 - year dynamic , 4 - month dynamic)

this case when aggregate data year level in 1980 contains data year , month dynamics.
i've read (http://mondrian.pentaho.com/documentation/aggregate_tables.php) pentaho can use aggregate table , want use them in order split month , year dynamics.
i've create 2 vies aggregate table purpose
create or replace view world_steel_production.world_steel_production_data_view_year select * world_steel_production.world_steel_production_data dl = 1 and
create or replace view world_steel_production.world_steel_production_data_view_month select * world_steel_production.world_steel_production_data dl = 4 but i'm wandering how pentaho in xml schema definition use first view year dynamics , second 1 month dynamics?
or maybe there way split year , months dynamics?
i think i've found solution. mondrian has such thing closure tables (http://mondrian.pentaho.com/documentation/schema.php#closure_tables ). @ table can define how aggregate in hierarchy dimension.
what i've done in situation:
- i've created , filled hierarchy table dates , link table data-table in schema.

- next i've created , filled closure table.

as can see, i've filled closure table world_steel_production_time_hierarchy has no hierarchy @ (time_id = parent_time_id).
- and @ last i've changed xml data definition.

Comments
Post a Comment