# [Mondrian] DAG-Dimensions with correct rollup

Peter Klotz peter.klotz at blue-elephant-systems.com
Thu May 29 04:21:14 EDT 2008

```Hi,

we have multiple dimensions what form a direct acyclic graph (DAG) not a tree,
that is both leaf elements as well as intermediates can have multiple parents.

For example like this:

G1
/ \
G2  G3   G4
/ \ / \ / \
|   G5  G6  L3
\ / \ /
L1 L2

Very ugly for OLAP for several reasons
- leafs (Lx) on multiple levels
- groups and leaves can have multiple parents on different levels

So one needs to use closure tables to solve the first problem.
The worst is, that one wants to sum up or count correctly that is

R
/ \
G1  G2
\ / \
L1  L2
=4  =5

then G1 should have value 4, and G2 9. Problem is R the root, it should have 9
in this case and counting this with OLAP is hard.
Becuase the hierarchy structure is only required for the navigation one could do

R
/ \
G1  G2
/    / \
L1  L1' L2
=4  =4  =5

for navigation perfect but it requires to create an artificial L1' (for parent
G2) and all combinations of all paths to the root. Will get a really large
dimension.

Furthermore one would need twice the fact (4) and map it once to L1 and once to
L1'. Then the hierarchy would show the right numbers but when combining it with
other dimensions summing up on the lowest level would count L1 twice!
Therefore, trick!, it would be nice to specify a DISTINCT COUNT for the measure
(count in this case) so that it would always count L1 only once.
BUT, according the Mondrian documentation one cannot use DISTINCT COUNT measures
with parent-child dimensions, which this most definitively is.

Has anybody worked with similar dimensions and solved this problem for both
accurate navigation as well as counting up correctly?
Is there an solution or workaround for using distinct-count measures with
parent-child dimensions available?
It is not really a solution to get wrong counts or not be able to navigate the
hierarchy, I can't easily change the concept behind this dimension!

Thanks, Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: peter.klotz.vcf
Type: text/x-vcard
Size: 550 bytes
Desc: not available
Url : http://lists.pentaho.org/pipermail/mondrian/attachments/20080529/596f520c/attachment.vcf
```