# Multidimensional Model

Multidimensional databases organize and present data in the structure of hyper-cubes, and you can imagine that these cubes exist in a multidimensional space, and each cube can be associated with several dimensions. Dimensions are similar to axes, while a dimension represents a specific business perspective, such as the date dimension and the region dimension. The interior of a cube is filled with some quantifiable data, which is called measure.

### Dimension

Dimensions are similar to axes, and a dimension also represents a business perspective. For example, an airline can analyze its turnover data through three business perspectives: classes of service dimension, aircraft models dimension and date dimension. ### Member

A member represents a definite value under the business perspective that a dimension represents. For example, there are members such as economy plus, business suite and first class suite under the classes of service dimension, A380 and Boeing 787 members under the aircraft models dimension, and members such as 2022, the first quarter of 2022, and January 2022 under the date dimension. Similar to thinking of dimensions as axes, you can think of members as scales on axes. Members under a dimension have parent-child relationships with each other, and they form a tree-like structure, the tree has a default root member. ### Cube

Cubes model represent data marts oriented to business topics, which are associated with several dimensions that describe some business perspectives. You can think of an 1D cube and a 2D cube as a line segment and a plane, and a 3D cube as a Rubik's cube in a Cartesian coordinate system. For cubes associated with more dimensions, they are multidimensional structures that exist in higher dimensional space, but you don't need to imagine what they look like, they are just described from more business perspectives, they have exactly the same characters as 3D cubes, as long as you understand 3D cubes you can understand higher dimensional cubes.
Some data called measure is populated inside cubes, such as revenue and cost.
Here's a cube about an airline, it has two measures revenue and cost, and associates three dimensions classes of service, aircraft models, and date. ### Measure

For a cube, dimensions representing business perspectives are descriptive information, and measures represent values that can be quantified.
Just as selecting a scale on each axis of a coordinate system determines a point, selecting a member on all dimensions of a cube determines a measure position that represents one or more measures.
In the cube shown in the figure below, the marked measure represents the revenue and cost of business suite service on the A380 aircraft in 2022. ### Level

Levels represent that members of the same level in the dimension tree structure, for example, the date dimension has four levels, one default root level represents the root member, and the other three levels represent the year, quarter, and month. ### Hierarchy

A hierarchy is a tree structure composed of dimension members, and a dimension will have a default hierarchy, and its name is generally the same as the dimension name.
A dimension may have multiple hierarchies, such as the aircraft models dimension, which has two hierarchies, one that categorizes aircraft models by aircraft manufacturer and one that categorizes aircraft models by aircraft size. It should be noted that members with the same name under different hierarchies are not the same member, such as [Airbus]. [A320] and [Medium]. [A320] is two different members, and a non-default hierarchy member is generally associated with a default hierarchy member.
Date dimension also have two hierarchies, one is the calendar hierarchy and the other is the financial hierarchy. Because some companies' fiscal years do not coincide with calendar years, for example, fiscal year 2022 starts in April 2022 and ends in March 2023, a separate date dimension hierarchy suitable for financial analysis needs to be designed.
The date dimension financial hierarchy is three months behind the calendar hierarchy. ### Dimension Role

An airline builds a cube for analyzing turnover data, which not only correlates the three dimensions of classes of service, aircraft models, and date, but also needs to analyze it from the perspective of flight starting point and flight ending point. Flight starting point and ending point are describing the region, they can be represented by the region dimension, this cube needs to be associated with the region dimension twice, so the concept of dimension role is introduced in EuclidOLAP, and the region dimension plays two dimension roles on this cube, flight starting point and flight ending point. For a dimension itself, it does not have a role attribute, and only when the dimension is associated by a cube, the association relationship is a dimensional role.
If a dimension is associated with a cube, it plays at least one dimension role, and if it plays multiple dimension roles, we need to indicate the specific dimension role when analyzing.
Since the hierarchy, level and member models all belong to a specific dimension, when this dimension is associated with a cube to form a dimensional role, these models under the dimensions will also form corresponding role information, which are hierarchy role, level role and member role. ### Tuple

A tuple consists of several dimension members associated with a cube, and the following are two tuples:
• ([Date]..[Q1].[M2], [Measures].[Revenue])
• ([Classes of Service].[Economy Plus], [Aircraft Models].[Airbus].[A380])
A dimension member can also be treated as a tuple, for example: [Measures].[Cost] can be equated with ([Measures].[Cost]).
When a tuple contains members of all dimensions to which the cube is associated, it is a complete tuple, otherwise it is a tuple fragment.
([Classes of Service].[Economy Plus], [Aircraft Models].[Boeing], [Date]., [Measures].[Cost]) is a complete tuple.
([Aircraft Models].[Boeing], [Date].) is a tuple fragment.
When performing multidimensional queries, a tuple fragment can be equated to a complete tuple in combination with context information.
If a complete tuple is composed of all leaf members, then it represents a specific detail measure of a cube, and if a complete tuple contains aggregate members, it corresponds to a aggregate measure, which is automatically summarized from some detail measures. ### Set

A Set consists of several tuples, and here are two sets:
• { Tuple_1, Tuple_2 }
• { Tuple_1, Tuple_2, Tuple_3, Tuple_4 }
A single tuple can also be thought of as a set, for example: Tuple_1 equivalent to { Tuple_1 }.
Similarly, since a single dimension member can be thought of as a tuple, a single member can also be thought of as a set, [Date]..[Q1] is equivalent to { ( [Date]..[Q1] ) }.
Set is generally used to define the display of a multidimensional query result, such as the following multidimensional query expression:
```select { [Date]. , [Date].  } on rows, { [Measures]. [Revenue], [Measures]. [Cost] } on columns from [Airline A];```
It defines two sets, { [Date].[ 2020], [Date].  } will be displayed on row position, { [Measures].[ Revenue], [Measures]. [Cost] } will be displayed on column position.
Execute this MDX(Multidimensional Expressions), and you will see the query result similar to the following table:
 Revenue Cost 2020 494849380 415181710 2021 590103250 497682690

### Summary

So far, we have learned all the basic concepts about OLAP multidimensional databases. Among them, Cube, Dimension, Hierarchy, Level, Member and Measure are the standard models for multidimensional databases. Dimension Role, Hierarchy Role, Level Role, and Member Role are extensions that EuclidOLAP added to enhance its data analysis capabilities. Tuple and Set belong to the composition structure, which is related to the definition of the MDX statement and the multidimensional query result returned.
The next article will introduce a demo example that runs through the EuclidOLAP documentation.