Heading 1 - scs.senecac.on.caron.tarr/DBW624/LABS/Lab-0…  · Web viewThese are part of...

download Heading 1 - scs.senecac.on.caron.tarr/DBW624/LABS/Lab-0…  · Web viewThese are part of management tools ... Click on the word Country on the data area ... You need to copy all

If you can't read please download the document

Transcript of Heading 1 - scs.senecac.on.caron.tarr/DBW624/LABS/Lab-0…  · Web viewThese are part of...

Heading 1

99-03-FM-Defining and Deploying a cube

This lab continues from lab 99-02. Hopefully you have saved your work and it is retrievable.

(If you didn't save or you can't retrieve your work, then start again. You will be doing it a lot so it is good practice, to the point where you can do it in less than 15 minutes)

The following tasks are performed in this lab

Task 1: Define a cube and define the cubes properties

Task 2: Reviewing the cube and the content

Task 3: Deploying an Analysis Services Project

TASK 1: Define a cube and properties

1 On the right hand side in Solution Explorer, highlight and right-click Cubes, and then click New Cube.

2 On the Welcome to the Cube Wizard page, click Next.

3 The Select Creation Method page appears and you are given four choices. Select the button marked Use existing tables, and then click Next.

4 The Select Measure Group Tables appears.

This screen will allow us to select which table is the fact tables, in other words which table contains the measures for the new cube.

If the data source view drop down does not show the data source then you have to enter the name. In your particular case there will likely be only one data source view and so it will be presented. But in some cases when you have worked on various projects there may be other views that can be selected.

In the box called Select Measure group tables check off of the FM SalesFact table as it contains measures.

Click Next.

5 The Select Measures page is shown below:

(NOT this one)

The default action taken by the cube wizard is to select all possible measures.

Depending upon the cube you are building you may not need some of these measures. Make sure the two measures Sales dollars and Sales units are selected. Do NOT select the FM Sales Fact Count as it is not required by management. Many fact tables have lots and lots of measures and they can be cleared or all selected based on the measure box being checked. Click Next.

6 the next page shows you all the dimensions that are associated with the measures that you have chosen. And the Select Existing Dimensions verify you have all of the dimensions you require.

Click Next.

7 Completing the Wizard page comes next. This page allows you to name the cube. The example shows FM-## and it is left that way for this tutorial.

8 Click Finish to complete the wizard

ASIDE: Each dimension table must be linked to a fact table within the cube. Dimension tables have one of the following types of relationship:

A primary key in the dimension table is directly connected to the foreign key in the fact table. This is referred to as a star schema. (All dimension tables are connected directly to the fact table and to NO other table)

A primary key is connected to the foreign key in the fact table indirectly meaning through some other table. This is referred to as a snowflake schema. An example might be a Product Category table connects to a Product table and then to a fact table. The Product Category table is indirectly connected to the fact table.

NOTE: Later you will see that a column or attribute of the fact table can be used to define a dimension table.

The screen returns to the following:

9 On the toolbar of Cube Designer, change the Zoom level (magnifying glass icon) to 50percent so that you can more easily see the dimensions and fact tables in the cube. Notice that the fact table is yellow and the dimension tables are blue. Change the zoom back.

10 Make sure you do a Save All.

This saves the changes you have made to this point in the Lab or Analysis Services project, so that you can stop the tutorial here if you want and resume it later.

You have successfully defined your first cube. Defining a simple cube is quick and easy with the Cube Wizard.

TASK 2: Reviewing the Cube

In the first task you built the cube structure. That structure was selected by the cube wizard based on the underlying database. During a cube wizard process you decided which measures and which attributes of the dimensions were needed for your cube. The cube has no data in it

In this task we will review the results of what we did in task one by using the Cube Designer. There wont be a lot to change in this task. Learning how to change the properties to get more usability comes much later.

Understanding the Cube Designer Tabs

(You can move the boxes around. Your view may look slightly different.)In Cube Designer, you can view and edit various properties of a cube. The designer contains the following tabs, which display different views of the cube.

Cube Structure

Use this tab to modify the architecture of a cube. You can change dimensions, hierarchies and other things in the cube.

Dimension Usage

Use this tab to define the relationships between dimensions and measure groups, and the granularity of each dimension within each measure group. If you use multiple fact tables, you might have to identify whether measures do not apply to one or more dimensions. Each cell represents a potential relationship between the intersecting measure group and dimension.

Calculations

Use this tab to examine calculations that are defined for the cube, to define new calculations for the whole cube or for a sub cube, to reorder existing calculations, and to debug calculations step by step by using breakpoints. We will use the calculation section during the project. Calculations allow you to define new members are attributes. For example we might need total profit as a measure. Total profit or really total gross profit is calculated by subtracting total costs from total sales. Because of this calculation ability we do not need to store total profit the fact table in our data warehouse. This reduces the size of the data warehouse.

KPIs

Use this tab to create, edit, and modify the Key Performance Indicators (KPIs) in a cube. KPIs enable the designer to quickly determine useful information about a value, such as whether the defined value exceeds a goal or falls short of the goal, or whether the trend for the defined value is getting better or worse.

Actions

Use this tab to create or modify drillthrough, reporting, and other actions for the selected cube. Actions provide to client applications context-sensitive information, commands, and reports that end users can access.

Partitions

Use this tab to create and manage the partitions for a cube. Partitions let you store sections of a cube in different locations with different properties, such as aggregation definitions.

Perspectives

Use this tab to create and manage the perspectives in a cube. A perspective is a defined subset of a cube, and is used to reduce the perceived complexity of a cube to the business user.

Translations

Use this tab to create and manage translated names for cube objects, such as month or product names.

Browser

Use this tab to view data in the cube. Remember at this stage you have not loaded the data into the structure.

To review cube and dimension properties in Cube Designer

1 Select the Cube Structure tab in Cube Designer. On the Measures pane (left side) expand the FM SalesFact measure group.

ASIDE: If you have Sales Count as a measure, you shouldnt have. However no harm is done for this lab. However, this cannot show up in a project or test unless it has been requested by management as a measure.

The measures that are defined for the FM SalesFact measure group appear.

( NOTE: Remember for when you do the assignment. You can change the order of these measures by dragging the measures into the order that you want. The order will affect how certain client applications order these measures. Try it. You will need to know this for the project as the order should follow a more logical flow based on the user (management) perspective. For example in a financial project the usual order is Revenue items followed by Expenses then Gross or Net Profit. Many students that do not have a financial background leave the measures in any order. Remember this is a reporting tool for management.)

Just read this next paragraph as you already changed the name. The measure group is named FM SalesFact because the underlying fact table had the friendly name of FM SalesFact in the data source view. Notice that a space was added automatically between Sales and Fact, based on the capitalized letter "F", to increase the user-friendliness of the name. The measure group and each measure that it contains have properties that you can be edited in the Properties window (bottom right side).

Highlight Sales Dollars in the Measures pane. The Properties pane in the bottom right should be as follows:

Change the name to read Total Sales Dollars and the other to Total Units Sold

Finding Dimension data

1 Click on the FM-##.dsv Tab

2 Right click the title bar of the Product SubCategory table and select Explore data

3 Select the Chart Tab just above the data shown and charts will be shown. You wont be doing anything with these it was just to look at only. These are part of management tools available

4 Go back by clicking on the FM-##.cube tab

5 In the Dimensions pane (lower left) of the Cube Structure tab in Cube Designer, review the cube dimensions that are in the cube.

6 Expand the Employee and then click Edit Employee.

3 The Employee dimension appears in Dimension Designer. (Note that Data Source View Designer and Cube Designer remain open.See image below)

Dimension Designer contains four tabs: Dimension Structure, Attribute Relationships, Translations, and Browser.

Notice that the Dimension Structure tab includes three panes:

Attribute Hierarchies and Levels Data Source View.

The employee dimension attributes need to include

Employee ID

Employee name

Manager ID so that we can do reports by manager or employee

4 Notice on the right side the attributes exist in the original source. Drag each of them across to the attributes pane and the result will look like the following:

The attributes that the Cube Wizard designed appear in the Attributes pane (for employee in our example) and the user hierarchy that the Cube Wizard defined appears in the Hierarchies and Levels pane. Notice that the Cube Wizard did not define a hierarchy on your screen. So you have to do it.

5 There exist in the table a hierarchy. Each manager has employees. That hierarchy needs to be built.

Drag Manager ID to the centre pane.

6 Drag Employee ID to the same pane placing under the Manager ID

Note the small square icon in front of the Manager ID and 2 squares in front of the Employee ID. This is symbolizing a 1:M relationship between the members.

Try dragging the Employee ID above the Manager ID. What did you see?

If you hover over the warning symbol it will explain the error.

Now drag it back to the correct hierarchy.

7 Go back to the FM-##.cube Design pane. You may not be able to see the tab. If you look just to the left of the Solution explorer pane there is an X and a drop down symbol.

Click on the drop down symbol and select FM-##.cube.

Edit the state dimension by adding to State ID the three attributes State Name, Region and Country.

8 Do the same for Product adding the following:

Brand name

Product name

Category

Subcategory

If this has not been done already, change the name of Category to a better choice of Category Name

Do the same for Subcategory

9 Go back to Cube Designer. You can do it several ways. Try these.

By clicking the Cube Designer tab in the design environment or

By right-clicking the cube name Solution Explorer and then clicking View Designer

10 Expand each of the dimensions by expanding the Attributes. Notice that under the employee dimension is the name Hierarchy. Since that is not a good name we need to change it. Having five or six hierarchies all called hierarchy is not informative to management that uses the cube. Right click hierarchy and select edit.

11 In the hierarchy box right click the hierarchy title and change the name to Manager-Employee.

Go back to Cube Designer

12 There is a need for hierarchies in the Product table also. In this case it is a 3 level hierarchy of Product to Sub Category to Category. Go ahead and build it. Call it Category-Sub-Product.

13 There is also a relationship of 1:M between Brand and Product. Build that hierarchy and name it Brand-Product.

14 State needs to be done. The hierarchy is Country Region State ID. Name it Country-Region-State. Did you notice it seems to be wrong? Try Region, Country and State.

It is quite possible that the hierarchy is Country Region State or it might be Country to State and another hierarchy for Region to State. This second alternative would occur if there was a Coastal Region that covered the states of Maine, Vermont and the provinces of Nova Scotia and New Brunswick. In this case the sale of products can be grouped by Country and by Region. However summing up the regions will not add up to the country total as region is not a sub grouping of country or the other way around. You have to view the data or understand the business to know which structure is correct. It is also possible that a province (state) is divided into more than one region because it does a lot of business. Again ask the user about their business.

Now build the two structures and name them as you see below

15 Back to the Cube Designer screen.

The result after you expanded all dimensions is shown below:

NOTE: In the AdventureWorksDW labs there is a quick look at each tab. This is left off this lab to simplify things. If you want to understand more use those labs

TASK 3: Deploying an Analysis Services Project

Right now you have built a cube structure. However, there is no data in the cube at this time. To view a cube with data in it, the cube or project needs to be deployed. This deploying process creates the objects in an instance and copies the data from the source into the cube objects.

This task simply looks at the deploying process.

To deploy the Analysis Services project

1 In Solution Explorer, right-click the project name, and then click Deploy.

The Deployment Progress usually appears in the bottom right pane, but later may appear in a number of places on the screen depending upon the state you left your project in.

If you cant see it, right click the project name and select Show Deployment Progress.

2 Review the Deployment Progress window to verify that the cube was built, deployed, and processed without errors.

3 If it has errors they need to be fixed before going further.

PROBLEM: No Time dimension.

Normally there would be a time dimension.

There is "time" dimension that is part of the fact table. More can be found on that aspect.

TASK 4: Browsing the Deployed Cube

The results of deploying the cube are that data exists that we can explore to see if it as management wants. As an IT person it is necessary to make adjustments to the cube to suit the user needs. For example if there are 30,000 products sold by the organization it is easier to relate to product names and the user would prefer to see names rather than numbers on any generated report.

How do we get to see the data?

View the data in the Browser tab in Cube Designer, and dimension data is viewable on the Browser tab in Dimension Designer.

In the following task, you browse the FM cube and each of its dimensions to determine the types of changes that need to be made to improve the functionality of the cube for management use.

To browse the deployed cube

1 Switch over to the following screen

(Meta data pane)

Dimension Designer for the Employee dimension by clicking the Employee tab in Business Intelligence Development Studio.

Click the Browser tab.

The Manager-Employee appears in the Hierarchy drop down box on the tool bar.

The current level is ALL

By default the member is called ALL and this can be changed. That will be done in the expanded labs. We will look at expanding these later to improve the output.

2 Go back to the cube designer, select cube in the next lower tab.

Here is another way to get to the STATE Designer pane. Like everything in Microsoft there is more than one way to get to a screen.

Right click on the state dimension and select edit.

The State Designer window appears. Go to the Dimension structure pane (bottom left).

There should be 2 hierarchies defined.

Define another hierarchy of

CountryRegionState Name

Notice the single, double and triple blue dots to the left of the name indicating a hierarchy.

Notice the warning symbol. Click and hover over the warning symbol and it will state there is no hierarchy. Ignore the warning for now as it is not a problem for this example.

Click on the word hierarchy and change the name to Location

Go to Solution Explorer window.

Highlight the project name at top (FM-##) and right click.

Select Deploy

You are still on the State .dim [Design] tab. Select the Browser tab.

Do not forget to click on the reconnect button to update the browser window.

Change the hierarchy box to show location.

Expand the All member of the (All) level to display the member countries. Expand all of them.

Take another look at the employee data

Here is what the data looks like in the original OLTP and in the data warehouse table

You can see that employee 3 or Maya Gutierrez has a manager named Sheri Nomer.

If we change the layout of the above list, the result would look like this.

1 Sherri Nowmer2 Darren Stanz

3 Maya Guitierrez4 Brenda Blumberg

5 Jonathan Murraiin6 Rebecca Kanagaki

7 Walter Cavestany

Sherri manages employees 2 and 3. Maya manages employees 4 and 5 etc.

Go the employee designer window (Employee.dim [Design] and display the Manager-Employee hierarchy.

Browse do not forget to reconnect

The result looks like this

If we go back and change the hierarchy to include Employee name, and deploy the result will be a little better.

(If you look at it the structure is correct, but the display is poor for management reporting.The 1 should read Sheri NowmerNotice that Sheri is also reporting to Sheri. That is caused by the data showing the manager of Sheri as 1. This could be left as null since she is at the top.THIS IS NOT A GOOD result but will do for now)

(For the assignment and a test this would not be a satisfactory result. In a small example like this it is possible to know who Employee 3 is, but in a large operation the name would be essential)Go to the cube designer

Click on Browser

Expand the measures and the dimension on the left.

Do not forget to reconnect.

Drag and drop some dimensions on to the middle section between the faint lines on the left side or between the lines on the top section. You will see the cursor change if you drag slowly enough.

Drag and drop the measure sales dollars into the middle blank area.

See if you can duplicate the following screens

Note that the display is poor, but it can be fixed. It does not show all the employees.

The reason turns out to be that Maya (#3) has Sheri (#1) as a manager but Maya is also a manager of others. In this business the managers do NOT generate sales.

Example: In a hierarchy of Stores belonging to Provinces belonging to Countries it is the store that has sales. The Provinces sales are an accumulation of the individual stores in that province. The country is an accumulation of Provincial Sales.

However, when people are involved some companies have sales managers that also sell. As an example, think of a car dealership with a sales manager and a leasing manager. Both of these individuals have sales also. In this case we would want to show the sales for the managers in the totals.

By default the screen shows only cells with data in it. To show all the people under a manager, right click the data and select show empty cells.

Right click on the data area and unclick show empty cells

Click on the word Country on the data area and drag it off the central area to remove the filter.

Put a new filter across the top and duplicate the screen you see.

Expand USA and North West only with the following result

Find out how to put a title on the report with your name and submit the entire screen shot for a small bonus mark.

YOU can play around with the cube if you want .and see what happens. Notice the data can be changed quickly without someone writing SQL. That eliminates the need for you in this part of the process. Dont worry there are more important things for you to do in building the data warehouse. It is a lot more complicated than you will see on this course.

Here is another fancy sample.

Drag all of the dimensions and measures off the pane to leave a cleared browser window.

Go to FILE and Save All.

You need to copy all of this to your own data area such as a USB if you dont want to start again from scratch.

Congratulations!

You have successfully browsed the cube created for you by the Cube Wizard, and are now familiar with certain elements of the FM-## project that you may want to change to improve user-friendliness and functionality.

NOTE:

1) There is no TIME dimension applied yet.

2) Manager name has not been fixed

These are left for you to discover how to handle

99-03-FM-Defining and Deploying a cube-NEW 4/30/201318 of 18