Вы находитесь на странице: 1из 21

Data warehouse ASSIGNMENT 3 – OLAP Group 18

ROYAL INSTITUTE OF TECHNOLOGY

DATA WAREHOUSING

ASSIGNMENT 3 – OLAP

GROUP 18

Bhatti, Waqas

Leghari, Arshad Ali

Luo, Haoxu

Vu, Phuong

1/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

The description of OLAP

assignment

Following the requirements of this assignment three, the task one


and two are easy to be finished.

Task one:

After setting up the project environment of “DW”, just to create


data source view and add the dimension as following:

First: dim Datum using time dimension: add two hierarchies as


requirement:

Second:dim butik

2/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

Third: dim Demografi:

Fourth: dim Kampanj

3/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

Fifth: dim Kund:

Sixth: dim Säljare

4/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

Seventh: dim Produkt

Task Two:

Create and configure a data cube as direction.

5/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

Task Three:

After creating the Cube of “Elektronikkedja”,what we need to do is


to select dimensions and Measures to answer the questions.

3.1

Which salesperson has sold the most products during the


year 2006 this far?
According to the description of question, year 2006, so getting the
hierarchy ‘år – månad – dag ’ of dim_detum and click the small
pane of 2006. Then choose the hierarchy ‘personnr ’ of Dim_Säljare
and chick to show the sub attribute of this dimension so that the
name of sale person could be showed. Now we have two conditions
of this question, next step is to get total count from Fact Kop and
chick the right button of mouse to choose sort descending. As the
following picture shows, the first row is salesperson who sold the
most products during 2006. ,

6/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

3.2

How much has the shop Electronics Bothell had in profit for
products of the category ”högtalarpaket”?
There are two conditions in this question,the one is product
category ‘högtalarpaket’ ,another is shop ‘Electronics Bothell’.So we
could get One hierarchy ‘kategori – tillverkare – beskrivning ’ from
dim_Produkt and choose the category ’ högtalarpaket’,then select
one hierarchy ’beskrivning’ from dim_Kampanj and choose
‘Electronics Bothell’ simultaneity.the final step is to get total profit
from Fact Kop.as is showed in the following:

7/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

3.3

How many purchases of products from Apple were made by


women in august 2006?

As it is described blew,first thing is to identify the condition of


question. Here there are three conditions, first one is August 2009
which we could get from dim_datum, next one is women which
could be selected from dim_demografi and the third one could be
chose hierarchy from dim_product ’.After these, the final part is to
get total profit from Fact Kop.

8/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

3.4

During which month was the sales amount highest this far?

Here ,get one hierarchy ‘månadsnamn ’ from dim_datum and get


total sum from Fact Kop .then sort descending with total sum. Then
we could find which month is the highest amount.

9/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

3.5

Which salesperson has sold the most of the product ”LCD-TV” this
far?

Like the same way we did before, confirm the conditions of the
question. one could get from One hierarchy ‘kategori – tillverkare –
beskrivning ’ from dim_Produkt and choose the category ’ LCD-TV’,
then select one hierarchy ‘personnr ’ of Dim_Säljare.The final step
is to get total count from Fact Kop. As is showed in the following:

Task four:

4.1

Display the total profit for all purchases made by customers with
the civilstatus ”married”.

10/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

select [Measures].[Total profit] on 0,


[Dim Demografi].[civilstånd – kön – årslön].
[Cilvilstånd].&[married] on 1
from [Elektronikkedja DW]

And we have tried to test the result using sql script in


Elektronikkedja DW:

select sum(vinst) from dbo.Fact_Köp


where demo_id in (
select id from dbo.Dim_Demografi where cilvilstånd = 'married'
)

4.2

Display using drillthrough a selection of 10 of the rows that


generated the value from 4.1.

drillthrough maxrows 10
select [Measures].[Total profit] on 0,
[Dim Demografi].[civilstånd – kön – årslön].
[Cilvilstånd].&[married] on 1
from [Elektronikkedja DW]

4.3

Display the number of purchases that were made by women per


year where years are displayed by column.

select [Measures].[Total Count] on 1,[Dim Datum].[År - Månad -


Dag].[År] on 0
from [Elektronikkedja DW]
where [Dim Demografi].[kön – civilstånd – årslön].
[Kön].&[female]

11/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

We have also tested using sql script:

select count(*) from dbo.Fact_Köp, dbo.Dim_Datum


where demo_id in (
select id from dbo.Dim_Demografi where Kön=’female’
) and dag = datum_id Group by År

4.4

Display the number of purchases and total profit for the period May
to September 2006 (each month by its own) made by customers
living in Seattle.

select
{( [Dim Datum].[År - Månad - Dag].[Månad].&[200605] ):
( [Dim Datum].[År - Månad - Dag].[Månad].&[200609] )} on 0,
{[Measures].[Total Count] ,[Measures].[Total profit]} on 1
from [Elektronikkedja DW]
where [Dim Kund].[postort – gatuadress].[Postort].&[Seattle]

We have also tested using sql script:

select månad,count(*),sum (vinst)


from Fact_Köp , dbo.Dim_Datum
where kund_id in (
select id from dbo.Dim_Kund where postort = 'Seattle')
and datum_id >= 20060501 and datum_id <= 20060930
and dag = datum_id
group by månad

4.5

Display how much bonus each salesperson has gotten for each
month. Months should be displayed as columns and the
salespersons names should be displayed as rows. Bonus for each
salesperson is calculated according to 0.01*sum_sales for the

12/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

salesperson.

WITH
MEMBER [Säljare namn] as [Dim Säljare].
[Personnr].Properties( "Namn" )
MEMBER [Measures].[Bonus] as [Measures].[Total sum] * 0.01
SELECT [Dim Datum].[Månadsnamn].[Månadsnamn] ON COLUMNS,
[Dim Säljare].[namn].[namn].members ON ROWS
FROM [Elektronikkedja DW]
where [Measures].[Bonus]

Task five:

5.1

[Profit_Per_Product]
According to the requirement, we add a new calculation named
‘Profit_Per_Product’ and write expression like following:

[Measures].[Total Profit]/[Measures].[Total Count]

Then test it in the browser:

13/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

5.2

[Profitability_Status]
Add new calculation named as ‘Profitability_Status’ and write the
expression:

case
when [Measures].[Total Profit]/[Measures].[Total Count]> 2000
then 'Very profitable'
when [Measures].[Total Profit]/[Measures].[Total Count]> 1500
then 'Profitable'
when [Measures].[Total Profit]/[Measures].[Total Count]> 1000
then 'Slightly profitable'
else 'Not profitable'
end

14/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

Display in the browser:

5.3

[Average_Sum_Per_Month]
The operation of adding new calculation is same with before.

15/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

[Measures].[Total Summa]/[Measures].[Total Count]

5.4

[Profit_Development]

16/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

We should pay attention to the first month .

Case
When [Dim Datum].[År - Månad - Dag].CurrentMember.Level Is
[Dim Datum].[År - Månad - Dag].[(All)]
Then ’’

When IsEmpty((
ParallelPeriod([Dim Datum].[År - Månad - Dag].[Månad],1,[Dim
Datum].[År - Månad - Dag].CurrentMember
),[Measures].[Total Summa]) )
then ''

Else (
( [Dim Datum].[År - Månad - Dag].CurrentMember,
[Measures].[Total Summa] )
-
(
ParallelPeriod
(
[Dim Datum].[År - Månad - Dag].[Månad],
1,
[Dim Datum].[År - Månad - Dag].CurrentMember
),
[Measures].[Total Summa]
)
)
/
(
ParallelPeriod
(
[Dim Datum].[År - Månad - Dag].[Månad],
1,
[Dim Datum].[År - Månad - Dag].CurrentMember
),
[Measures].[Total Summa]
)
End

17/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

5.5

[Sales_Deviation]

18/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

Case
When [Dim Datum].[År - Månad - Dag].CurrentMember.Level Is
[Dim Datum].[År - Månad - Dag].[Dag]
then ([Measures].[Total Summa]-6000000)/6000000
When [Dim Datum].[År - Veckonr - Dag].CurrentMember.Level Is
[Dim Datum].[År - Veckonr - Dag].[Veckonr]
Then ([Measures].[Total Summa]-6000000*(Count(Descendants([Dim
Datum].[År - Veckonr - Dag].currentmember, [Dim Datum].[År -
Veckonr - Dag].[Dag], SELF))))/((Count(Descendants([Dim Datum].
[År - Veckonr - Dag].currentmember, [Dim Datum].[År - Veckonr -
Dag].[Dag], SELF)))*6000000)
when [Dim Datum].[År - Månad - Dag].CurrentMember.Level Is
[Dim Datum].[År - Månad - Dag].[Månad]
Then ([Measures].[Total Summa]-6000000*(Count(Descendants([Dim
Datum].[År - Månad - Dag].currentmember, [Dim Datum].[År - Månad
- Dag].[Dag], SELF))))/((Count(Descendants([Dim Datum].[År -
Månad - Dag].currentmember, [Dim Datum].[År - Månad - Dag].[Dag],
SELF)))*6000000)
When [Dim Datum].[År - Månad - Dag].CurrentMember.Level Is
[Dim Datum].[År - Månad - Dag].[År]

Then ([Measures].[Total Summa]-6000000*30*(Count(Descendants([Dim


Datum].[År - Månad - Dag].currentmember, [Dim Datum].[År -
Månad - Dag].[Månad], SELF))))/((Count(Descendants([Dim Datum].
[År - Månad - Dag].currentmember, [Dim Datum].[År - Månad -
Dag].[Månad], SELF)))*30*6000000)

else ''
end

Display in the browser:

19/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

Task six:

Create new action:select target type as cell, target object as All


cells, condition like

Not isempty([dim product].[tillverkare].currentmember.name


[beskrivning]) and Not isempty([dim product].
[beskrivning].currentmember.name)
Action type :URL. Action Expression like following:

"http://www.google.se/search?q="+[Dim Produkt].
[Tillverkare].currentmember.name+ " " +[Dim Produkt].
[Beskrivning].currentmember.name

The following picture is the detail about configuration of actions.

20/21
Data warehouse ASSIGNMENT 3 – OLAP Group 18

After finishing the configuration of action, using browser to test .as


the following shows :click the button of ‘action’ would open the
search information of this product on the google website.

21/21

Вам также может понравиться