[Mondrian] Creating a parent-child dimension

Brian Vandenberg phantall at gmail.com
Tue Oct 14 13:07:27 EDT 2008


  When you create a parent-child hierarchy, if you aren't using a closure
table all you have to do is make sure the keys line up.  Assuming a simple
measure, one located in your fact table, your defined measure will have an
aggregate function defined for it, and Mondrian should handle it just fine.

  Once you have that working, add a closure table -- you'll need this for
performance reasons -- and try it out to make sure everything is still
working properly.  Here's an example:

<Schema name="whatever">
..<Dimension type="StandardDimension" name="Group">
....<Hierarchy
......name="Group Hierarchy"
......hasAll="true"
......allMemberName="All Groups"
......allLevelName="All"
......primaryKey="group_tk"
....>
......<Level name="Groups"
........column="group_tk"
........nameColumn="grp_label"
........ordinalColumn="grp_label"
........parentColumn="group_parent_fk"
........nullParentValue="0"
........type="Numeric"
........uniqueMembers="true"
........levelType="Regular"
........hideMemberIf="Never"
......>
........<Closure parentColumn="group_parent_fk" childColumn="group_tk">
..........<Table name="groupdimension_closure" />
........</Closure>
......</Level>
....</Hierarchy>
..</Dimension>
..<Cube (...)>
....<DimensionUsage source="Group" name="Group" foreignKey="group_fk" />
....<Measure name="Total Sales" column="sales" datatype="Numeric"
aggregator="sum" visible="true />
....(...)
..</Cube>
</Schema>

-Brian
On Tue, Oct 14, 2008 at 1:57 AM, Eduardo Andrade
<eduardofandrade at gmail.com>wrote:

> Hello,
>
> i hope you could guide me on this :
>
> - I've two parent child structures for each one of the fact table rows.
>
> - Each fact table row points to level three records of the hierarchical
> table and Mondrian is able to build the dimension correctly.
>
> But, when building a parent-child hierarchy I thought Mondrian would group
> the elements by the defined "nameColumn" and apply the defined aggregation
> function (in this case SUM).
>
> I show two results (the obtained one and the expected one (which i was
> expecting to see)).
>
>
> Is there a way to achieve this result ?
>
>
> Btw, it's probably a good idea to create a mondrian user list, i'll be
> using it for sure :)
>
> Thank you for your time.
>
> --
> Eduardo Andrade
> eduardofandrade at gmail.com
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20081014/ee690be6/attachment.html 


More information about the Mondrian mailing list