Professional Documents
Culture Documents
Level 300
Ashwani Roy
Senior Consultant –Information Management Group
Speaker Intro
Microsoft SQL Server MVP
Answerer on http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices
Member of Authoring Team – SQL Server 2008 MCP exams 70-451 Questions
I Tweet @ http://twitter.com/ashwani_roy
Agenda
4. Questions
There is an app for..MDX
• And lots of other tools and utility that Management studio lacks
• http://cid-74f04d1ea28ece4e.skydrive.live.com/browse.aspx/MDXStudio/v0.4.14
The Online Version
Cool consultants working at customer site, where software installations are not allowed
Why and How to use MDX Studio
Most popular feature ever !!
FE Cache
SE Query plan
Steroids for MDX
• Dynamic Sets
• Attribute Relationships
• Cache Warming
A Scenario
Calculation 1 - {f(x)}/{g(x)}
Calculation 2 - {h(x)}/{g(x)}
Can be Optimized to
Calculation 0- {g(x)}
DEMO 2:- FE caching
WITH WITH
MEMBER [Measures].CALCULATION1 AS
MEMBER [Measures].CALCULATION0 AS
[Measures].[Internet Sales Amount]
/
Count
Count (
( BottomSum
BottomSum (
( [Account].[Account].[Account].MEMBERS
[Account].[Account].[Account].MEMBERS*
* [Date].[Date].[Date].MEMBERS
[Date].[Date].[Date].MEMBERS
,10 ,10
,[Measures].[Internet Sales Amount]) ,[Measures].[Internet Sales Amount]
) )
MEMBER [Measures].CALCULATION2 AS )
[Measures].[Internet Tax Amount] MEMBER [Measures].CALCULATION1 AS
/
Count
[Measures].[Internet Sales Amount] /
( [Measures].CALCULATION0
BottomSum MEMBER [Measures].CALCULATION2 AS
( [Measures].[Internet Tax Amount] /
[Account].[Account].[Account].MEMBERS* [Measures].CALCULATION0
[Date].[Date].[Date].MEMBERS
SELECT
,10
,[Measures].[Internet Sales Amount])
{
[Measures].CALCULATION1
) ,[Measures].CALCULATION2
SELECT } ON 0
{ ,[Customer].[Gender].[Gender].MEMBERS ON 1
[Measures].CALCULATION1
FROM [Adventure Works];
,[Measures].CALCULATION2
} ON 0
,[Customer].[Gender].[Gender].MEMBERS ON 1
FROM [Adventure Works];
DEMO 3 :- Dynamic Sets !!
WITH WITH
MEMBER MEASURES.MYRANK AS SET MYSET AS
Rank Order
( (
[Date].[Date].CurrentMember [Date].[Date].
[Date].MEMBERS
,Order
,[Measures].[Internet Sales
(
Amount]
[Date].[Date].[Date].MEMBERS
,BDESC
,[Measures].[Internet Sales )
Amount] MEMBER MEASURES.MYRANK AS
,BDESC Rank
) (
) [Date].
SELECT [Date].CurrentMember
MEASURES.MYRANK ON 0 ,MYSET
,[Date].[Date].[Date].MEMBERS ON 1 )
FROM [Adventure Works]; SELECT
MEASURES.MYRANK ON 0
,[Date].[Date].[Date].MEMBERS
ON 1
FROM [Adventure Works];
Bulk Computation
• Most important optimization technique with MDX in Analysis Services is to rewrite MDX in such a
way that makes block computations possible. …Mosha
Cell-by-cell Subspace
vs.
DEMO 4 : - Bulk Computation
“How Many” satisfy a “condition”
WITH WITH
MEMBER [Measures]. MEMBER [Measures].
[ProductsONInternet] AS [ProductsONInternet] AS
IIF Count
( (
Filter //Products Ordered On
[Measures].[Internet Order
Internet
Quantity] > 0
(
,1 [Product].[Product].[Product]
,NULL ,
) [Measures].[Internet Order
SELECT Quantity] > 0
//Geographically )
[Customer].[Customer Geography]. )
[Country].MEMBERS ON 0 SELECT
,[Date].[Calendar].[Date].MEMBERS ON 1 [Customer].[Customer Geography].
FROM [Adventure Works] [Country].MEMBERS ON 0
WHERE //Geographically
[Measures].[ProductsONInternet]; ,[Date].[Calendar].[Date].MEMBERS ON
1
FROM [Adventure Works]
WHERE
[Measures].[ProductsONInternet];
Quiz-Spot what can go wrong
WITH
MEMBER
[Measures].AvgProductSales AS
Avg
(
NonEmpty
(
[Product].[Product].
[Product].MEMBERS
,[Measures].[Sales Amount]
)
,[Measures].[Sales Amount]
)
SELECT
[Measures].AvgProductSales ON 0
,[Date].[Date].[Date].MEMBERS ON
1
FROM [Adventure Works];
Bulk Computation Demo
WITH WITH
MEMBER [Measures].AvgGrowingProducts AS MEMBER [Measures].[SalesGrowth] AS
Avg IIF
( (
Filter Measures.[Sales Amount]
( >
[Product].[Product].[Product].MEMBERS (
, [Measures].[Sales Amount]
[Measures].[Sales Amount] ,ParallelPeriod([Date].[Calendar].[Month])
> )
( ,[Measures].[Sales Amount]
[Measures].[Sales Amount] ,NULL
,ParallelPeriod([Date].[Calendar].[Month]) )
) MEMBER [Measures].AvgGrowingProducts AS
) Avg
,[Measures].[Sales Amount] (
) [Product].[Product].[Product].MEMBERS
SELECT ,[Measures].[SalesGrowth]
[Measures].AvgGrowingProducts ON 0 )
,Descendants SELECT
( [Measures].AvgGrowingProducts ON 0
[Date].[Calendar].[Calendar Year].&[2003] ,Descendants
,[Date].[Calendar].[Date] (
) ON 1 [Date].[Calendar].[Calendar Year].&[2003]
FROM [Adventure Works]; ,[Date].[Calendar].[Date]
) ON 1
FROM [Adventure Works];
Profiling and Debugging Using MDX Studio
MY PAIN with Management Studio
DEMO
PerfMon Counters..what do they stand for
THANK YOU