## Cube

### Entry Point

Well, we have everything up to here:

• We read the data

• We designed the schema.

• We also implemented the dimensions based on the schema

• And we eventually created the required hierarchies inside the dimensions

And our work is clean and perfect since we designed the map correctly from the beginning and followed it.

Now we should place them in a specific OLAP database.

This means that we are going to implement the second component of the third step which is the cube.

Now you realize why we determined some steps for SSAS projects and said we should move forward based on them.

We said that each step has a specific goal you should understand first and then do everything required in that step correctly so that the work moves forward professionally and smoothly.

So let’s have a review:

In the previous section, we created the three dimensions we needed and applied the hierarchies the project required.

Now we should place them in an OLAP database.

Remember that the cube acts as an OLAP database.

Since we are going to make a cube in the following, we should specify the list of the facts and dimensions that fall into this cube.

The process of the work is just as simple as the rest of it.

Now let’s create our cube.

### Data Analysis Environment

#### Visual Studio 2022

We are going to make a cube in the following.

we should specify the list of the Facts and Dimensions that fall into this cube.

Concepts: OLAP

### Create Cube

To create a cube, you should go through the following steps:

#1

Just like before, the first thing we do is that we find the object we need.

Since we will create a cube here, we should take action from the part called cubes.

We should right-click on it and select the “new cube” option from the open menu.

#2

The cube wizard then opens where all you should do is hit next and go to the next step.

#3

In this window, three options ask us to specify how the cube will be created.

Since we have created the dimensions and facts already and have them, we select the first option, “use existing tables,” for making the cube.

#4

Now we reach the stage where we should specify the facts and dimensions.

It asks us in this window and the next one to determine the Facts, and then we should define the Dimensions for it.

So what did it ask of us in the first part of this window?

It tells us to specify the data source.

This refers to the map we created in the second step.

All I should do here is select our DSV.

I select the DSV here.

Now, what is it showing me down here?

It shows me the list of the dimensions and facts defined in this data source.

What should I select in this section?

I should select the facts.

So I selected these two facts, including Factinternetsales and Factresellersales, as the project’s facts.

#5

The following window concerns this fact table and shows the fields of the fact table you selected.

Since we selected both fact tables in the previous step, it now shows both fact tables and the fields in each of them.

Here we should specify which measures of each fact we need.

Each measure does something special, and you should select the calculations you need here based on your work requirement.

Now I will check all of them and go to the next stage.

#6

You should select the dimensions that you need in the next section.

We created three dimensions, and I will choose all three of them and hit next.

#7

Looking at the title of the next window, you will see that new dimensions are discussed.

Here it is saying that you can create new dimensions from the tables in the DSV if you want to.

Since we have created all the dimensions we need in the previous step, we do not need to make any new Dimensions here.

So we deselect them and click next.

#8

And now we get to the final window in the creation of a cube where we should select a name for our cube, I choose Adventure Works DW2019 again.

Let’s look at the dimensions and facts that we have too.

You see here that the connection between the Dimensions and Fact has been made through the Primary key and Foreign key (The primary key in the Dimension and its repetition in the Fact as a foreign key).

For example, the ProductKey field is the primary key in DimProduct, and the same field is in the Factinternetsales; this has made the connection between the two tables.

Now before anything else, let’s take the fourth step and store the result of the work.