The dimensions in the Cube may be regular, composite, or range-based. The difference between the types lies in the way of generating dimension members. While for regular dimensions their members are the records from the dimension table or values from the fact table, the members of other dimension types are generated in another manner.
Regular Dimensions
A regular dimension is a dimension whose members are the actual records from the dimension table or actual values from the fact table. A regular dimension may be flat or hierarchical. The hierarchy of such dimensions is defined by a parent-child relation, and can be balanced, unbalanced, or ragged. A regular dimension contains a number of attributes equal to the number of columns selected upon its definition.
A regular dimension may be based on a separate (dimension) table in the database or may be build directly from the fact table, if no dimension table defined. In this case, the dimension members are formed from the unique values of the corresponding columns of the fact table.
Hierarchical dimensions
It is often convenient to represent a dimension as a hierarchy. For example, it would be natural to divide products names in the "Product" table by their categories and providers by their geographical location. One of the ways to describe hierarchical relations will be using "snowflake" schemas. Another way (and no less common) is describing hierarchical structure as parent-child relations within a single table.
Every record in such a table has a link to the "parent" record, and only the "root" records of the tree have NULL values in the "parent" column. Note that a hierarchy with a parent-child relation, may be either "balanced" (all the leaves of a tree located in the same distance from its root) or "unbalanced" (the distances can be different). In the following diagram the hierarchy is unbalanced.
Composite hierarchical dimensions
HierCube library supports the composite hierarchical dimensions. Using this method several fields of the fact table can be combined into a single hierarchical dimension, suitable for using in the Cube. For example, using such dimensions it's possible to describe hierarchical relations in the "snowflake" schema. Also, it is convenient to represent time dimensions as composite. For example, you can create the composite dimension with the three hierarchical levels: Year, Quarter, and Month. In this case, it is possible to work specifically with the selected time intervals.
Range-based and time dimensions
Generally, in any fact table there is at least one field of "date-time" type. For example, in the table "Sales" it can be sale date or invoicing date. Usually these fields are not used as dimensions directly, but they serve as a basis for creating a number of calculated dimensions that work in the Cube's dimension map as real dimensions. Examples of such dimensions can be "Year", "Month", "Day", "Week", and “Hour". In the VCL-version for creating such dimensions, the standard mechanism of calculated fields is used. It is applicable for any data set, which is a successor of standard TDataSet component (for example see TDataSet.OnCalcField in Delphi documentation and the demo application). Time dimentions are usually handled this way, because, in comparison to selecting specified items from a strictly limited list of options, it gives the necessary flexibility of choice.
Another type of dimensions is "range-based". This is a dimension whose members are created from the values of any numeric field in the fact table. To create dimension members all the values from the fact table are divided into several ranges. It can be used to represent many different values from the fact table in several ranges (for example "X <= 10", "10 < X <= 20", "20 < X"). HierCube Library supports two methods of range forming: "equal ranges" (every range has approximately equal length) and "equal density" (every range has approximately equal amount of fact table values).