I have xml schema description for Pentaho Mondrian. It looks like 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 AS year, date_part('month', "dt")::integer AS month, date_part('day', "dt")::integer AS day from "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 two levels: "year" and "month"
When I choose level "year" Mondrian aggregates data by year.
It seems fine, but table world_steel_production_data has two dynamic levels in data which defines columns dl (1 - year dynamic and 4 - month dynamic)
This case when I aggregate data by year level in 1980 contains data with year and month dynamics.
I've read (http://mondrian.pentaho.com/documentation/aggregate_tables.php) that Pentaho can use aggregate table and I want to use them in order to split my month and year dynamics.
I've create two vies for aggregate table purpose
create or replace view world_steel_production.world_steel_production_data_view_year
as
select *
from world_steel_production.world_steel_production_data
where dl = 1
and
create or replace view world_steel_production.world_steel_production_data_view_month
as
select *
from world_steel_production.world_steel_production_data
where dl = 4
But now I'm wandering how to say to Pentaho in my xml schema definition use the first view for year dynamics and second one for month dynamics?
Or maybe there is another way to split year and months dynamics?