PHP Analytics

How data are structured

As you do web app, you are not a specialist of Business Intelligence. Don’t worry! We introduce you to the concepts you need.

 

OLAP Cube

An OLAP cube is a data structure used to perform analysis. It is made of facts organized within several dimensions. Facts are sets of measures, as shows the figure below.

Even though this cube contains only three, a cube can actually have up to 128 dimensions.

Measures

The measures are numeric values, such as the cost of some items, that can be aggregated by being summed, averaged, counted, etc.

Dimensions

Dimensions are made of hierarchies, which are made of levels. The values of the levels are called the “members”. Thus, a member may have a parent or children, depending on its position in the hierarchy.

All the facts have one value inside each dimension, in the lower level of the hierarchies. Then, by querying at a higher level, the measures from the facts can be aggregated (by summing all values for example).

Sets, tuples and members

To query an OLAP cube, we often have to provide sets (e.g. the axes or the slicer).

A tuple is a collection of one member from one or more dimension (a dimension must not appear more than once in a tuple). It can be seen as a conjunction (“and”).

A set is a collection of tuples having the same dimensionality (i.e. having members from the same dimensions). It can be seen as a disjunction (“or”).

Examples:

  • [Date].[1998] is a member
  • [Location].[America] is a member
  • ([Date].[1998], [Location].[America]) is a tuple
  • {([Date].[1998], [Location].[America]), ([Date].[1999], [Location].[Europa])} is the set

You will find nice illustrations and examples on the Microsoft website.

Cubes organization

The environment where the cubes are stored is divided in a 4-level hierarchy:

  1. Connections: each connection is linked with one (and only one) database;
  2. Catalog: A catalog does the mapping between the relational database and the OLAP cube; each catalog contains one schema;
  3. Schema: A schema contains the cubes;
  4. Cubes: The cube name is the lower level.

Thus, when you want to select a cube, you have to provide a value for every level.
With Saiku the connection name is the name provided in the datasource file, the catalog name and the schema name are the same and are defined in the catalog file. Finally, the cube name is the cube you want to query.