Sunteți pe pagina 1din 15

What is the use of data warehousing?

Can we perform all the


transformations using Oracle?
Datawarehousing:The use of datawarehousing is subject-oriented historical timely varient integrated
collection of data is called datawarehousing.
with the help of this one u can do analysis and generate reports based on DW data.
Transformations:it is one of the ETL tool.
Transformation means convert data into based on business rules then load in the
datawarehousing.
>Data warehousing is used to store large amount of data from different
databases.The source data we collect may be in different format.So we transform
them to the data warehouse format using ETL tools.From the data warehouse the
datas can be retrieved using SQL or like some other query tools and we can generate
reports.
>Datawarehousing is nothing but analysing the data and providing solutions to the
business people.
Major usage of datawarehousing is that it can analyse the data and stored the data
which is historical.
with the 2007 Microsoft Office system, delivers business intelligence on the
desktop in an integrated, centrally managed environment.
Business Intelligence simplifies information discovery and analysis,
making it possible for decision-makers at all levels of an organization to
more easily access, understand, analyze, collaborate, and act on
information, anytime and anywhere. Move from just consuming
information to developing deep contextual knowledge about that
information. By tying strategy to metrics, organizations can gain
competitive advantage by making better decisions faster, at all levels of
the organization.
Business Intelligence delivers business intelligence to everyone in an
organization by integrating two major components:
* The Business Intelligence platform, driven by Microsoft SQL Server
2005 and including its powerful relational database management system,
SQL Server Integration Services, SQL Server Analysis Services, SQL
Server Reporting Services, and SQL Server Data Mining capabilities.

Business Intelligence is built on the scalable and reliable SQL Server 2005
platform, proven to support mission-critical environments, and integrated
with the Microsoft Visual Studio 2005 development platform.
The 2007 Microsoft Office system, delivering information through the
tools that users already know and rely on. Users can share more
powerful, interactive spreadsheets using improved charting and formula
authoring, greater row and column capacity, and enhanced sorting and
filtering along with enhanced PivotTable and PivotChart views. With
server-based spreadsheets, you can share information broadly with
confidence, knowing that your information is more secure and centrally
managed, yet accessible to colleagues, customers, and partners through
the Web. Dynamic scorecards combine the power of predictive analysis
with real-time reporting. Strategy maps make it easy to visualize key
areas you can see trends, identify problem areas early, maximize
success areas, and monitor performance against key goals in real time.
Q. Who is Business Intelligence for?
Business Intelligence is for businesses that want to drive intelligent
decision-making throughout their organizations and make it easy for
everyone in the organization to collaborate, analyze, share, and act on
business information from a centrally managed, more secure source.
Enterprise grade yet attractively priced, Business Intelligence supports IT
professionals, information workers, and developers, and empowers
organizations of all sizes.
Q. What if I have a small (fewer than 100-person) company? Can I still use
Business Intelligence?
Yes. Business Intelligence provides an excellent business intelligence
solution for organizations of all sizes. You can deploy reporting solutions
to a small workgroup or department with SQL Server 2005 Reporting
Services. You can also perform queries and analysis using Excel Services
new to the 2007 release of Microsoft Office through Microsoft Office
SharePoint Server 2007. This combination delivers Web-based query and
analysis capabilities to every user in a format that is easy to use and
centrally secured and managed.
Q. Whats a typical way an organization might use Business Intelligence?
Business Intelligence connects the right people to the right information at
the right time. For example, when reviewing the current financial
scorecard, your sales manager, Margaret, notices that one particular
region is not contributing as much as other regions. When analyzing the
data from the spreadsheet for the low-performing region, she notices that
one particular salesperson, Joe, has below-average sales numbers.

At the same time, Joe receives through e-mail a weekly status report that
contains qualified leads in the region, pipeline information, and details
about deals closed. Next, he opens the dashboard and searches on
information about his top account, and he sees data from his enterprise
resource planning (ERP) system related to that account. Joe notes that his
average deal size is smaller than others in the region. Its easy for Joe to
find out why this is by doing some "what if" analysis. He inputs different
variables to determine the number of leads he needs to reach the
company sales average. Next, by doing further analysis on data for the
region, Joe can compare his sales numbers with regional averages. He
adds more information that shows the discount rate, and then adds
visualization to better understand the results. The visual representation of
the data shows Joe that his discount rate is much lower than the average
for the region.
Next, its time to tell his manager. Joe publishes this information to the
server, schedules a meeting with Margaret to discuss getting approval to
increase the discount rate so that hell be better able to compete, and
alerts Margaret through online collaboration that hes just posted his
analysis report.
Joe and Margaret meet to discuss details. Afterward, he makes a note on
the key performance indicator (KPI) that he owns for that region, and
Margaret sees the annotation in her latest scorecard as a reminder that
theres a new strategy in place to increase Joes results and address the
poor sales performance.
What programs are included in Business Intelligence? Is Business Intelligence
available as a single product in a box?
Business Intelligence includes two major components: the business
intelligence platform (SQL Server 2005) and end-user tools the 2007
Microsoft Office system.

MDX
How do you get Last month in the time dimension
SELECT ClosingPeriod([Date].[Calendar].[Month], [Date].
[Calendar].DefaultMember) ON 0FROM [Sales Summary]WHERE
([Measures].[Sales Amount]);
I Need an MDX statement to show the first day of the last month
in the cube
SELECT OpeningPeriod([Date].[Calendar].[Date], ClosingPeriod([Date].
[Calendar].[Month], [Date].[Calendar].DefaultMember) ) ON 0FROM
[Sales Summary]
I Need an MDX statement to get the last Month loaded into a cube
SELECT ClosingPeriod([Date].[Calendar].[Month], [Date].
[Calendar].DefaultMember) ON 0FROM [Sales Summary];
How do you write MDX query that uses execution date/time as a
parameter?
SELECT {[Measures].[Internet Order Count]} ON 0,
{StrToMember("[Date].[Date].[" + Format(now(), "MMMM dd, yyyy") +
"]")} ON 1FROM [Direct Sales];
Need MDX Query to get latest months and previous years same
months data
SELECT {ClosingPeriod([Date].[Calendar].[Month], [Date].
[Calendar].DefaultMember), ParallelPeriod([Date].[Calendar].[Calendar
Year] , 1, ClosingPeriod([Date].[Calendar].[Month], [Date].
[Calendar].DefaultMember) ) } ON 0
FROM [Sales Summary];
How to create calculated member for AVG sales over last 3 years
based on NOW()?
CREATE MEMBER CurrentCube.Measures.[Avg3Years] AS
Avg( {ParallelPeriod( [Date].[Date].[Date Yr], 3, StrToMember("[Date].

[Date].&[" + Format(now(), "yyyyMMdd") + "]")): StrToMember("[Date].


[Date].&[" + Format(now(), "yyyyMMdd") + "]")}, [Measures].[Sales
Qty]) ;
How can I get Last (Previous) Year to Date (YTD) values?
WITH MEMBER [Measures].[Current YTD] ASSUM(YTD([Date].
[Calendar].CurrentMember), [Measures].[Internet Order
Quantity])MEMBER [Measures].[Last YTD] AS
SUM(YTD(ParallelPeriod([Date].[Calendar].[Calendar Year], 1 , [Date].
[Calendar].CurrentMember)), [Measures].[Internet Order Quantity] )
SELECT {[Measures].[Current YTD], [Measures].[Last YTD] } ON 0FROM
[Adventure Works]WHERE ([Date].[Calendar].[Date].[March 22, 2004])
How do you calculate monthly average of a year?
WITH MEMBER [Measures].[AvgVal] AS Avg( Descendants([Date].
[Calendar].[Calendar Year].&[2004], [Date].[Calendar].[Month]),
[Measures].[Internet Order Count] )SELECT {[Measures].[AvgVal]} ON
0FROM [Adventure Works]WHERE ([Product].[Product Model Lines].
[Model Name].&[Classic Vest])
Need a MDX query that returns list of months from start of year up
to specified month.
SELECT YTD([Date].[Calendar].[Month].&[2003]&[8])ON 0FROM [Sales
Summary];

How in the report can I order date dimension members in


descending order?
SELECT {[Measures].[Reseller Order Quantity]} ON 0 ,
ORDER(Tail([Date].[Calendar].[Calendar Year].Members, 3), [Date].
[Calendar].CurrentMember.Member_Key, DESC ) ON 1 FROM [Adventure
Works]

I Need an MDX statement to get the first month of the last year
loaded into a cube
SELECT OpeningPeriod([Date].[Calendar].[Month], ClosingPeriod([Date].
[Calendar].[Calendar Year], [Date].[Calendar].DefaultMember) ) ON
0FROM [Sales Summary];

I need an MDX query to show year level data for all years except
the last one, and month level data for the last year.
SELECT {NULL:ClosingPeriod([Date].[Calendar].[Calendar Year], [Date].
[Calendar].DefaultMember).PrevMember,
DESCENDANTS(ClosingPeriod([Date].[Calendar].[Calendar Year], [Date].
[Calendar].DefaultMember), [Date].[Calendar].[Month]) } ON 0
FROM [Sales Summary];
How do I calculate sales for 12 Month to date in MDX?
WITH MEMBER [Measures].[Last 12 Mth Order Count] AS
SUM( ClosingPeriod([Date].[Calendar].[Month], [Date].[Calendar].[All
Periods]).Lag(12): ClosingPeriod([Date].[Calendar].[Month], [Date].
[Calendar].[All Periods]), [Measures].[Order Count])SELECT [Measures].
[Last 12 Mth Order Count] ON 0
FROM [Adventure Works]
MDX query to get count of months with sales amount > 0 in
defined period
WITH Member [Measures].[Months With Above Zero Sales] AS
COUNT(FILTER( DESCENDANTS({[Date].[Calendar].[Calendar
Year].&[2003]: [Date].[Calendar].[Calendar Year].&[2004]}, [Date].
[Calendar].[Month]) , [Measures].[Sales Amount] > 0 ) )SELECT
{[Measures].[Sales Amount], [Measures].[Months With Above Zero
Sales]} ON 0, [Product].[Product Model Lines].[Product Line].Members on
1FROM [Adventure Works]WHERE ([Date].[Calendar].[Calendar
Year].&[2003]: [Date].[Calendar].[Calendar Year].&[2004]);

How do you calculate monthly average of a year including empty


months?
WITH MEMBER [Measures].[AvgVal] AS Avg( Descendants([Date].
[Calendar].[Calendar Year].&[2004], [Date].[Calendar].[Month]),
CoalesceEmpty([Measures].[Internet Order Count], 0))SELECT
{[Measures].[AvgVal]} ON 0FROM [Adventure Works]WHERE ([Product].
[Product Model Lines].[Model Name].&[Classic Vest])
Q: How do I find the bottom 10 customers with the lowest sales in
2003 that were not null?
A: Simply using bottomcount will return customers with null sales. You
will have to combine it with NONEMPTY or FILTER.

SELECT { [Measures].[Internet Sales Amount] } ON COLUMNS ,


BOTTOMCOUNT(
NONEMPTY(DESCENDANTS( [Customer].[Customer Geography].[All
Customers]
, [Customer].[Customer Geography].[Customer] )
, ( [Measures].[Internet Sales Amount] ) )
, 10
, ( [Measures].[Internet Sales Amount] )
) ON ROWS
FROM [Adventure Works]
WHERE ( [Date].[Calendar].[Calendar Year].&[2003] ) ;
Q: How in MDX query can I get top 3 sales years based on order
quantity?
A: By default Analysis Services returns members in an order specified
during attribute design. Attribute properties that define ordering are
"OrderBy" and "OrderByAttribute". Lets say we want to see order counts
for each year. In Adventure Works MDX query would be:
SELECT {[Measures].[Reseller Order Quantity]} ON 0
, [Date].[Calendar].[Calendar Year].Members ON 1
FROM [Adventure Works];
Same query using TopCount:
SELECT
{[Measures].[Reseller Order Quantity]} ON 0,
TopCount([Date].[Calendar].[Calendar Year].Members,3, [Measures].
[Reseller Order Quantity]) ON 1
FROM [Adventure Works];
Q: How do you extract first tuple from the set?
A: Use could usefunction Set.Item(0)
Example:
SELECT {{[Date].[Calendar].[Calendar Year].Members
}.Item(0)}
ON 0
FROM [Adventure Works]
Q: How do you compare dimension level name to specific value?
A: Best way to compare if specific dimension is at certain level is by using

'IS' operator:
Example:
WITH MEMBER [Measures].[TimeName] AS
IIF([Date].[Calendar].Level IS [Date].[Calendar].[Calendar
Quarter],'Qtr','Not Qtr')
SELECT [Measures].[TimeName] ON 0
FROM [Sales Summary]
WHERE ([Date].[Calendar].[Calendar Quarter].&[2004]&[3])
Q: MDX query to get sales by product line for specific period plus
number of months with sales
A: Function Count(, ExcludeEmpty) counts number of non empty set
members. So if we crossjoin Month with measure we will get set that we
can use to count members.
Query example:
WITH Member [Measures].[Months With Non Zero Sales] AS
COUNT(CROSSJOIN([Measures].[Sales Amount]
, DESCENDANTS({[Date].[Calendar].[Calendar Year].&[2003]: [Date].
[Calendar].[Calendar Year].&[2004]}, [Date].[Calendar].[Month]))
, ExcludeEmpty
)
SELECT {[Measures].[Sales Amount], [Measures].[Months With Non Zero
Sales]} ON 0
, [Product].[Product Model Lines].[Product Line].Members on 1
FROM [Adventure Works]
WHERE ([Date].[Calendar].[Calendar Year].&[2003]: [Date].[Calendar].
[Calendar Year].&[2004])
Q: How can I setup default dimension member in Calculation
script?
A: You can use ALTER CUBE statement. Syntax:
ALTER CUBE CurrentCube | YourCubeName UPDATE DIMENSION ,
DEFAULT_MEMBER='';
Q: I would like to create MDX calculated measure that instead of
summing children amounts,uses last child amount
A: Normally best way to create this in SSAS 2005 is to create real
measure with aggregation function LastChild. If for some reason you still

need to create calculated measure, just use fuction .LastChild on current


member of Date dimension, and you will allways get value of last period
child.
Example: We want to see last semester value for year level data. Lets first
see what data values are at Calendar Semester level:
SELECT {[Measures].[Internet Order Count]} ON 0
, DESCENDANTS([Date].[Calendar].[All Periods],[Date].[Calendar].
[Calendar Semester] ) ON 1
FROM [Adventure Works]
Q: How to calculate YTD monthly average and compare it over
several years for the same selected month?
A: MDX Query:
WITH MEMBER Measures.MyYTD AS SUM(YTD([Date].[Calendar]),
[Measures].[Internet Sales Amount])
MEMBER Measures.MyMonthCount AS SUM(YTD([Date].[Calendar]),
(COUNT([Date].[Month of Year])))
MEMBER Measures.MyYTDAVG AS Measures.MyYTD /
Measures.MyMonthCount
SELECT {Measures.MyYTD, Measures.MyMonthCount,[Measures].[Internet
Sales Amount],Measures.MyYTDAVG} On 0,
[Date].[Calendar].[Month] On 1
FROM [Adventure Works]
WHERE ([Date].[Month of Year].&[7])
Q: MDX query to get sales by product line for specific period plus
number of months with non empty sales.
A: You can use COUNT() function with ExcludeEmpty option. For count
function you specify set that is corssjoin of Date members at the month
level and measure that you are interested in.
WITH Member [Measures].[Months With Above Zero Sales] AS
COUNT(
DESCENDANTS({[Date].[Calendar].[Calendar Year].&[2003]: [Date].
[Calendar].[Calendar Year].&[2004]}
, [Date].[Calendar].[Month]) * [Measures].[Sales Amount]

, ExcludeEmpty
)
SELECT {[Measures].[Sales Amount], [Measures].[Months With Above
Zero Sales]} ON 0
, [Product].[Product Model Lines].[Product Line].Members on 1
FROM [Adventure Works]
WHERE ([Date].[Calendar].[Calendar Year].&[2003]: [Date].[Calendar].
[Calendar Year].&[2004])
Q: How do I group dimension members dynamically in MDX?
Source: MSDN SSAS Newsgroup.
A: You can create calculated members for dimension and then use them in
the query. Example below will create 3 calculated members based on filter
condition:
WITH MEMBER [Product].[Category].[Case Result 1] AS '
Aggregate(Filter([Product].[Category].[All].children, [Product].
[Category].currentmember.Properties("Key") < "3"))'
MEMBER [Product].[Category].[Case Result 2] AS '
Aggregate(Filter([Product].[Category].[All].children, [Product].
[Category].currentmember.Properties("Key") = "3"))'
MEMBER [Product].[Category].[Case Result 3] AS '
Aggregate(Filter([Product].[Category].[All].children, [Product].
[Category].currentmember.Properties("Key") > "3"))'
SELECT NON EMPTY {[Measures].[Order Count] } ON COLUMNS
, {[Product].[Category].[Case Result 1],[Product].[Category].[Case Result
2],[Product].[Category].[Case Result 3] } ON ROWS
FROM [Adventure Works]
Q: How can I compare members from different dimensions that
have the same key values?
Lets say I have dimensions [Delivery Date] and [Ship Date]. How
can I select just records that were Delivered and Shipped the
same day?
A: You can use FILTER function and compare member keys using
Properties function:
SELECT {[Measures].[Internet Order Count]} ON 0
, FILTER( NonEmptyCrossJoin( [Ship Date].[Date].Children, [Delivery
Date].[Date].Children

)
, [Ship Date].[Date].CurrentMember.Properties('Key')
= [Delivery Date].[Date].Properties('Key')
) ON 1
FROM [Adventure Works]
Q: How can I get attribute key with MDX
A:
To do so, use Member_Key function:
WITH
MEMBER Measures.ProductKey as [Product].[Product
Categories].Currentmember.Member_Key
SELECT {Measures.ProductKey} ON axis(0),
[Product].[Product Categories].Members on axis(1)
FROM [Adventure Works]
Q: How do I create a Rolling 12 Months Accumulated Sum
(InternetSalesAmtR12Acc) that can show a trend without
seasonal variations?
A: Here is query example
WITH MEMBER [Measures].[InternetSalesAmtYTD] AS SUM(YTD([Date].
[Calendar].CurrentMember),[Measures].[Internet Sales Amount]),
Format_String = "### ### ###"
MEMBER [Measures].[InternetSalesAmtPPYTD] AS
SUM(YTD(ParallelPeriod([Date].[Calendar].[Calendar Year],1,[Date].
[Calendar].CurrentMember)),
[Measures].[Internet Sales Amount]), Format_String = "### ### ###"
MEMBER [Measures].[InternetSalesAmtPY] AS
SUM(Ancestor(ParallelPeriod([Date].[Calendar].[Calendar Year],1,[Date].
[Calendar].CurrentMember),[Date].[Calendar].[Calendar Year]),
[Measures].[Internet Sales Amount]),Format_String = "### ### ###"
MEMBER [Measures].[InternetSalesAmtR12Acc] AS ([Measures].
[InternetSalesAmtYTD]+[Measures].[InternetSalesAmtPY] )- [Measures].
[InternetSalesAmtPPYTD]
Select {[Measures].[Internet Sales Amount], Measures.
[InternetSalesAmtYTD], [Measures].[InternetSalesAmtPPYTD],

[Measures].[InternetSalesAmtR12Acc]} On 0,
[Date].[Calendar].[Month].Members On 1
From [Adventure Works]
Where ([Date].[Calendar Year].&[2004]);
Q: How to setup calculated measure as default measure for a
cube?
A: Use ALTER Cube statement on measures dimension. Example:
ALTER CUBE CURRENTCUBE UPDATE DIMENSION Measures,
DEFAULT_MEMBER=[Measures].[Profit]
Q: How can I write MDX query for the count of customers for
whom the earliest sale in the selected time period (2002 and
2003) occurred in a particular Product Category
A: Example of such query:
WITH SET [FirstSales] AS
FILTER(NONEMPTY( [Customer].[Customer Geography].
[Customer].MEMBERS
* [Date].[Date].[Date].MEMBERS
, [Measures].[Internet Sales Amount])
AS MYSET,
MYSET.CURRENTORDINAL = 1 or
NOT(MYSET.CURRENT.ITEM(0) IS MYSET.ITEM(MYSET.CURRENTORDINAL2).ITEM(0)))
MEMBER [Measures].[CustomersW/FirstSales] AS
COUNT(NonEmpty([FirstSales], [Measures].[Internet Sales Amount])),
FORMAT_STRING = '#,#'
SELECT {[Measures].[Internet Sales Amount],[Measures].
[CustomersW/FirstSales]} ON 0,
[Product].[Product Categories].[Category] ON 1
FROM [Adventure Works]
WHERE ({[Date].[Calendar].[Calendar Year].&[2002], [Date].[Calendar].
[Calendar Year].&[2003]}, [Customer].[Customer Geography].
[City].&[Calgary]&[AB]);
Q: How do you write MDX query that returns measure ratio to
parent value?

A: Below is example on how is ratio calculated for measure [Order Count]


using Date dimension. Using parent function, your MDX is independant on
level that you are querying data on. In example below, if you query data
at year level, ratio will be calculated to level [All]:
WITH MEMBER [Measures].[Order Count Ratio To Parent] AS
IIF( ([Measures].[Order Count], [Date].[Calendar].CurrentMember.Parent)
=0
, NULL
, [Measures].[Order Count]
/
([Measures].[Order Count], [Date].[Calendar].CurrentMember.Parent)
)
, FORMAT_STRING = "Percent"
SELECT {[Measures].[Order Count], [Measures].[Order Count Ratio To
Parent]} ON 0
, {DESCENDANTS([Date].[Calendar].[All Periods], 1), [Date].[Calendar].
[All Periods]
} ON 1
FROM [Adventure Works]
SCOPE function provided below:
SCOPE ( Filter([Date].[Calendar].[Month].MEMBERS, [Date].
[Calendar].Properties("Month of Year") = "January") );
Measures.[Amount] = 10;
END SCOPE;
Q: How do you specify SCOPE for a Dimension to include all
members before a certain member
A: Use NULL:<ToDimMember>. Example:
SCOPE(NULL:[Date].[Calendar].[Calendar Quarter].&[2003]&[3]);
This = 100;
END SCOPE;
Q: How Can I define SCOPE in MDX for all measures in one
measure group?
A: You can use function MeasureGroupMeasures()
Example:
SCOPE(MeasureGroupMeasures("Sales Orders"));
This = ...;
END SCOPE;

Q: How Can I define SCOPE in MDX for all measures in multiple


measuregroups?
A: You can use multiple functions MeasureGroupMeasures() that are
separated by commas. You have to enclose this into curly brackets:
Example:
SCOPE({MeasureGroupMeasures("Internet Sales"),
MeasureGroupMeasures("Internet Orders"),
MeasureGroupMeasures("Internet Customers") });
This = ...;
END SCOPE;
Q: Can you create a SCOPE based on the Member property?
A: Yes you can, example below.
SCOPE ( Filter([Date].[Calendar].[Month].MEMBERS
, [Date].[Calendar].Properties("Month of Year") = "January") );
Measures.[Amount] = 10;
END SCOPE;
Q: How do you specify SCOPE for a Dimension to include all
members after a certain member
A: Use <FromDimMember>:NULL. Example:
SCOPE([Date].[Calendar].[Calendar Quarter].&[2003]&[3]: NULL);
This = 100;
END SCOPE;
Q: How Can I define SCOPE in MDX for all but one measures in one
measure group?
A: You can use function MeasureGroupMeasures() and subtract set of
measures that should be excluded.
Example:
SCOPE(MeasureGroupMeasures("Internet Sales") - {[Measures].[Internet
Tax Amount]});
This = ...;
END SCOPE;

S-ar putea să vă placă și