Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Drive your life.Einführung in MDX                Matthias Gessenay                Matthias.gessenay@corporatesoftware.ch
Was ist MDX «SQL» für multidimensionale Datenbanken Sehr kurze Abfragen mit relativ komplexen Ergebnissen   YTD   Roll...
Ergebnis/*                  Reseller Sales Amount   Reseller Transaction Count   Reseller Order CountRoad Bikes           ...
CUBE: EINFÜHRUNG SQL Day 2012      4
Der Microsoft BI Solution Stack                                  Data Infrastructure & BI                                 ...
Business ProductivityInfrastructure  Dashboards &  Scorecards  Excel Services  Web based forms &  workflow  Collaboration ...
Delivered through aFamiliar Interface  Self-Service access &  insight  Data exploration & analysis  Predictive analysis  D...
OLTP vs. Cube OLTP   Optimiert für Write   Normalisierung   NICHT optimiert für Reporting Cube   De-Normalisiert   ...
SQL Day 2012   9
Tuple SQL   Wenn ich nichts auswähle, kommen alle Datensätze (Rows) MDX   Wenn ich nichts auswähle, kommt das default ...
SELECT    {        ([Measures].[Reseller Sales Amount]),        ([Measures].[Reseller Transaction Count]),        ([Measur...
SELECT    {        ([Measures].[Reseller Sales Amount]),        ([Measures].[Reseller Transaction Count]),        ([Measur...
DEMO: CUBE SQL Day 2012   13
MDX SCHRITT FÜR SCHRITT SQL Day 2012             14
Wir möchten gerne dies:/*EnglishProductName      TotalSalesAmountMountain-200 Black, 38      1327957.4077Mountain-200 Blac...
Variante SQL:USE MdxStepByStep                                               ON m.ProductKey=n.ProductKey                 ...
Variante MDX:WITHMEMBER [Measures].[Total Sales Amount] AS    ([Measures].[Internet Sales Amount]) + ([Measures].[Reseller...
DEMO SQL Day 2012   18
Funktionen & With1. WITH2. MEMBER [Measures].[Total Sales Amount] AS3. [Measures].[Internet Sales Amount]+[Measures].[Rese...
Where Schränkt den Cube ein (Slicing) Verändert damit die Resultate SQL Day 2012                       20
WHERE: DEMO SQL Day 2012   21
MDX Anwendungsbereiche   Reporting Services   Excel   PerformancePoint   Eigene Apps ...   SSISSQL Day 2012          ...
FRAGEN? SQL Day 2012   23
Upcoming SlideShare
Loading in …5
×

Einführung in mdx

834 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Einführung in mdx

  1. 1. Drive your life.Einführung in MDX Matthias Gessenay Matthias.gessenay@corporatesoftware.ch
  2. 2. Was ist MDX «SQL» für multidimensionale Datenbanken Sehr kurze Abfragen mit relativ komplexen Ergebnissen  YTD  Rolling Average  Net Performance Beispiel:SELECT { ([Measures].[Reseller Sales Amount]), ([Measures].[Reseller Transaction Count]), ([Measures].[Reseller Order Count]) } ON COLUMNS, TopCount( {[Product].[Subcategory].[Subcategory].Members}, 5, ([Measures].[Reseller Sales Amount]) ) + {([Product].[Subcategory].[All Products])} ON ROWSFROM [Step-by-Step]; SQL Day 2012 2
  3. 3. Ergebnis/* Reseller Sales Amount Reseller Transaction Count Reseller Order CountRoad Bikes $29,358,206.96 12,850 1,460Mountain Bikes $26,492,684.38 7,487 1,215Touring Bikes $10,451,490.22 4,463 478Mountain Frames $4,713,672.15 4,476 860Road Frames $3,849,853.34 4,708 1,013All Products $80,450,596.98 60,855 3,796 Liegt immer als Pivot vor SQL Day 2012 3
  4. 4. CUBE: EINFÜHRUNG SQL Day 2012 4
  5. 5. Der Microsoft BI Solution Stack Data Infrastructure & BI Platform Analysis Services Reporting Services Master Data Services Integration Services Data Mining Data Warehousing
  6. 6. Business ProductivityInfrastructure Dashboards & Scorecards Excel Services Web based forms & workflow Collaboration Search Content Management LOB data integration PowerPivot for SharePoint
  7. 7. Delivered through aFamiliar Interface Self-Service access & insight Data exploration & analysis Predictive analysis Data visualization Contextual visualization PowerPivot for Excel 2010
  8. 8. OLTP vs. Cube OLTP  Optimiert für Write  Normalisierung  NICHT optimiert für Reporting Cube  De-Normalisiert  Optimiert für ReportingSQL Day 2012 8
  9. 9. SQL Day 2012 9
  10. 10. Tuple SQL  Wenn ich nichts auswähle, kommen alle Datensätze (Rows) MDX  Wenn ich nichts auswähle, kommt das default Measure als Summe Die Schnittmenge von den Cube-Kanten nennt man Tuple Der Cube ist gefüllt mit Measures (Zahlen)SQL Day 2012 10
  11. 11. SELECT { ([Measures].[Reseller Sales Amount]), ([Measures].[Reseller Transaction Count]), ([Measures].[Reseller Order Count]) } ON COLUMNS, TopCount({[Product].[Subcategory].[Subcategory].Members}, 5, ([Measures].[Reseller Sales Amount]) ) + {([Product].[Subcategory].[All Products])} ONROWSFROM [Step-by-Step]SQL Day 2012 11
  12. 12. SELECT { ([Measures].[Reseller Sales Amount]), ([Measures].[Reseller Transaction Count]), ([Measures].[Reseller Order Count]) } ON COLUMNS, TopCount({[Product].[Subcategory].[Subcategory].Members}, 5, ([Measures].[Reseller Sales Amount]) ) + {([Product].[Subcategory].[All Products])} ONROWSFROM [Step-by-Step]SQL Day 2012 12
  13. 13. DEMO: CUBE SQL Day 2012 13
  14. 14. MDX SCHRITT FÜR SCHRITT SQL Day 2012 14
  15. 15. Wir möchten gerne dies:/*EnglishProductName TotalSalesAmountMountain-200 Black, 38 1327957.4077Mountain-200 Black, 42 1139429.4872Mountain-200 Silver, 38 1136622.4928Mountain-200 Black, 46 1011074.3685Mountain-200 Black, 38 NULLMountain-200 Silver, 42 1011486.1762Touring-1000 Blue, 60 835290.1559Road-350-W Yellow, 48 897217.9635Mountain-200 Silver, 46 1029170.7639Road-350-W Yellow, 40 840970.6467*/SQL Day 2012 15
  16. 16. Variante SQL:USE MdxStepByStep ON m.ProductKey=n.ProductKey LEFT OUTER JOIN ( --PRODUCT SALES IN 2004SELECT SELECT m.EnglishProductName, o.TotalSalesAmount a.ProductKey, SUM(a.SalesAmount) AS TotalSalesAmountFROM dbo.DimProduct m FROM (INNER JOIN ( -- TOP 10 PRODUCTS OF 2003 SELECT SELECT TOP 10 x.productkey, x.salesamount a.ProductKey, SUM(a.SalesAmount) AS TotalSalesAmount FROM dbo.FactInternetSales x FROM ( INNER JOIN dbo.DimDate y SELECT ON x.OrderDateKey=y.DateKey x.productkey, x.salesamount WHERE y.CalendarYear=2004 FROM dbo.FactInternetSales x UNION ALL INNER JOIN dbo.DimDate y SELECT ON x.OrderDateKey=y.DateKey x.productkey, x.salesamount WHERE y.CalendarYear=2003 FROM dbo.FactResellerSales x UNION ALL INNER JOIN dbo.DimDate y SELECT ON x.OrderDateKey=y.DateKey x.productkey, x.salesamount WHERE y.CalendarYear=2004 FROM dbo.FactResellerSales x ) a INNER JOIN dbo.DimDate y GROUP BY a.ProductKey ON x.OrderDateKey=y.DateKey ) o WHERE y.CalendarYear=2003 ON m.ProductKey=o.productkey ) a ORDER BY n.TotalSalesAmount DESC GROUP BY a.ProductKey ORDER BY TotalSalesAmount DESC ) n SQL Day 2012 16
  17. 17. Variante MDX:WITHMEMBER [Measures].[Total Sales Amount] AS ([Measures].[Internet Sales Amount]) + ([Measures].[Reseller SalesAmount])SET [Top 10 Products of 2003] AS TOPCOUNT( {[Product].[Product].[Product].Members}, 10, ([Measures].[Total Sales Amount], [Date].[Calendar Year].[CY2003]) )SELECT {([Measures].[Total Sales Amount])} ON COLUMNS, {[Top 10 Products of 2003]} ON ROWSFROM [Step-by-Step]WHERE ([Date].[Calendar Year].[CY 2004]); SQL Day 2012 17
  18. 18. DEMO SQL Day 2012 18
  19. 19. Funktionen & With1. WITH2. MEMBER [Measures].[Total Sales Amount] AS3. [Measures].[Internet Sales Amount]+[Measures].[Reseller Sales Amount]4. SET [Top 10 Products of 2003] AS5. TOPCOUNT( [Product].[Product].[Product].Members, 10, ([Measures].[Total Sales Amount], [Date].[Calendar Year].[CY 2003]))6. SELECT7. {([Measures].[Total Sales Amount])} ON COLUMNS,8. {[Top 10 Products of 2003]} ON ROWS9. FROM [Step-by-Step]10.WHERE [Date].[Calendar Year].&[2004] SQL Day 2012 19
  20. 20. Where Schränkt den Cube ein (Slicing) Verändert damit die Resultate SQL Day 2012 20
  21. 21. WHERE: DEMO SQL Day 2012 21
  22. 22. MDX Anwendungsbereiche Reporting Services Excel PerformancePoint Eigene Apps ... SSISSQL Day 2012 22
  23. 23. FRAGEN? SQL Day 2012 23

×