I have a situation where Saiku sometimes displays an unexpected/undesirable value, until I re-run the exact same calculation.
It is where a fact table has a 1:many relationship with a dimension table.
For example;
- Each fact is a sweetie purchase
- The sweetie-preferences dimension table can have multiple records per customer
---> Customer1 prefers Chocolate and Toffee
---> Customer2 prefers Toffee and BonBons
---> Customer3 prefers BonBons and Chocolate
-----> Each Customer has 2 records in the sweetie dimension table
If I look at sales by sweety preference; each customer (correctly) contributes their sales to two different catgories.
---> Customer's sales appear included within the "Chocolate" row AND the "Toffee" row
Then, if I remove the preference dimension from the report, the results include multi-counting (As if Mondrian expects that it can simply SUM() across the three sweeties to get the overall aggregated value).
Until I refresh the exact same query again, then it gives the 'correct' values.
Is this 1:many relationship something supported by Mondrian? Or have I just stepped over a line that I didn't even know existed?
Cheers,
Mat.
It is where a fact table has a 1:many relationship with a dimension table.
For example;
- Each fact is a sweetie purchase
- The sweetie-preferences dimension table can have multiple records per customer
---> Customer1 prefers Chocolate and Toffee
---> Customer2 prefers Toffee and BonBons
---> Customer3 prefers BonBons and Chocolate
-----> Each Customer has 2 records in the sweetie dimension table
Code:
CustomerID | Purchase Date | Value
------------+---------------+-------
1 | 1 | 2.0
2 | 2 | 5.0
3 | 1 | 3.0
CustomerID | Preferred Sweeties
------------+--------------------
1 | Chocolate
1 | Toffee
2 | BonBons
2 | Toffee
3 | BonBons
3 | Chocolate
---> Customer's sales appear included within the "Chocolate" row AND the "Toffee" row
Code:
Preferred Sweeties | Sales Value
--------------------+-------------
BonBons | 8.0 (3.0 + 5.0)
Chocolate | 5.0 (2.0 + 3.0)
Toffee | 7.0 (2.0 + 5.0)
Then, if I remove the preference dimension from the report, the results include multi-counting (As if Mondrian expects that it can simply SUM() across the three sweeties to get the overall aggregated value).
Code:
Sales Value
-------------
20.0 (3.0 + 5.0) + (2.0 + 3.0) + (2.0 + 5.0)
Code:
Sales Value
-------------
10.0 (2.0 + 3.0 + 5.0)
Is this 1:many relationship something supported by Mondrian? Or have I just stepped over a line that I didn't even know existed?
Cheers,
Mat.