Some people are frequently asking around how to use Virtual Cubes, so I've setup this simple example to demonstrate a working prototype.
- Pentaho Data Integration - preferably 6+
- Running Pentaho BA Server - preferably 6+
- PostgreSQL - DDL provided for this database, but others will work when adapted.
- Run the script
data/schema.postgres.sql
on your PostgreSQL;
- Or adapt this script for your DBMS and run - pull requests for other databases are welcome.
- Open the transformation
support-etl/load_data_into_db.ktr
- Change the connection settings according to the settings of your DBMS (host, port, database, usernrame, password);
- Run the transformation;
- Create a connection within your BA Server (File > Manage Datasources > cogwheel-icon > New Connection) if non-existent;
- Make sure that the JDBC Driver for your DBMS exists into
tomcat/lib
- On File > Manage Datasources, click the cogwheel icon and choose Import Analysis;
- On Mondrian File, click the
[...]
icon to locate the fileschema/OncaseVirtualCubeExample.xml
that is stored in your computer; - Choose the DataSource that points to the DBMS that you're using for this example.
- Click Import;
From now on, you should see three cubes available in your OLAP players:
- Vendas
- Compras
- Vendas x Compras
Vendas x Compras is a virtual cube that combines informations from both cubes, Vendas and Compras.
All the dimensions used in this virtual cube are present in both cubes; I kept it simple for learning purposes.
If planned to add dimensions that are not present in both cubes, you should:
- On the virtual cube, hide the measures from the cube that doesn't have all the dimensions
- Make use of these hide measures into calculated members attached to the VirtualCube like so:
ValidMeasure ([Measures].[My hidden measure])
This formula will make your measure (that one that doesn't have all the dimensions) always visible by forcing the non existent dimension to its toplevel into the tuple in which it's contained.
But use it carefully: http://jira.pentaho.com/browse/MONDRIAN-2280