report_design_for_ssas_mdx_turley_3.pptx

download report_design_for_ssas_mdx_turley_3.pptx

of 25

Transcript of report_design_for_ssas_mdx_turley_3.pptx

SQL Server 2008 Building Business Intelligence Solutions

Report Design for SSAS Cubes and MDX Paul TurleyMentor, SQL Server MVP

October 11-14, Seattle, WA 0IntroductionPaul TurleyMentor, SQL Server MVP

SqlServerBiBlog.com1

BID 302 | MDX Essentials for Report Design1

What Can You Do with a Cube?2Destroy anything in its pathAggregate very large volumes of dataAssimilate entire civilizationsCreate a mega race of neo-humanoid androids with a single collective consciousnessPresent browse-able business information for self-service reportingEncapsulate complex business rules into predefined hierarchies, calculations, business measures and KPIsCreate high-value business reports that render in a fraction of the time of a relational data sourceBID 302 | MDX Essentials for Report DesignHC-850 BI Solutions 20082The Business Data Continuum3

Operational DatabasesData Consolidation & Transformation(ETL)Relational Data WarehouseOLAP CubesReports, Charts, Dashboards & Scorecards

BID 302 | MDX Essentials for Report DesignThe business data continuum consists of multiple phases. All of these components are not necessarily required for every business intelligence solution. There may also be variations to this process depending on the size, scope and needs of the business.Generally, data must be consolidated from a variety of sources. These operational data sources may consist of various production databases and may consist of nontraditional data sources such as flat text files, delimited export data, Excel spreadsheets and other desktop documents.An automated data transformation tool, such as Microsoft SQL Server 2008 Integration Services, may be used to merge, cleanse and integrate data from these multiple sources into a central, reliable data repository for reporting. Cyclical data loads may be automated so that reporting data is updated and available at regular intervals.A relational data warehouse or data marts house business reporting data in simplified structures. The purpose of this database is to store business information, optimized for retrieval, reporting and analytics. OLAP cubes contain predefined relationships, navigational patterns and dimensional hierarchies. Business facts are strategically aggregated and calculations may be used to define the business rules and complex algorithms. Cubes may be browsed by users without the need for special skills and complex reporting tools.Reports, charts, dashboards, spreadsheets, pivot tables and KPI scorecards are based on OLAP cubes or data warehouse data.3Dimensional Data Warehouse Design4Date DimensionEmployeeDimensionGeographyDimensionCustomer DimensionProductDimensionVendorDimensionSales FactBID 302 | MDX Essentials for Report Design4Contrasting Data Source PerformanceUsing a transactional data source5

20 minutes to run500,000 recordsBID 302 | MDX Essentials for Report DesignHeres a common scenario to help reinforce the value of an effective business intelligence solution.As business systems evolve, databases become larger and more complex. Reports that were once simple and fast become slow and inefficient. Complex queries consist of many tables, relationships and business logic. This is because transactional databases are often very complex. Queries based on these databases are often slow in the error-prone. As the systems evolve, development becomes cumbersome and expensive. Report designers and developers spend more of their time writing queries and performing debugging tasks rather than developing reports.In this example, 500,000 records are returned in 20 minutes and our user is not having a good experience.5Contrasting Data Source PerformanceUsing an OLAP cube6

2 seconds to run query100,000,000 source recordsBID 302 | MDX Essentials for Report DesignBy contrast, lets look at a report running against an OLAP cube.The cube is based on a data warehouse that contains 100,000,000 source fact records. The dimensions of the cube are predefined with hierarchies and relationships to support our business reporting requirements. Many of the business facts are pre aggregated and optimized for reporting. The cube is processed overnight with fresh data.Because the report designer spent little time writing queries, this afforded more time to design an effective report with charts, graphs and other specialized visualizations. When the user runs the report, it literally takes only seconds to run. This user has a much better reporting experience with the report that provides more business value. As a result, he is able to take action, make informed decisions and run an efficient and profitable business. Our user thinks that rocks!6Cube Design Process7BID 302 | MDX Essentials for Report DesignBasic cube design ends after the third step, when the cube is created.

To move into the more advanced cube functions, we need to look into the business needs.

Partitions allow the cube to be stored in different files, potentially on different storage devices, and can be used to aggregate at different levels: Ex. Legacy data from years past can be optimized for a higher level of granularity.HC-850 BI Solutions 20087Dimensions8

Dimension > Hierarchy > Level > MemberBID 302 | MDX Essentials for Report DesignIn Microsoft SQL Server Analysis Services, a time dimension is a dimension type whose attributes represent time periods, such as years, semesters, quarters, months, and days.

The periods in a time dimension provide time-based levels of granularity for analysis and reporting. The attributes are organized in hierarchies, and the granularity of the time dimension is determined largely by the business and reporting requirements for historical data. For example, most financial and sales data in business intelligence applications use a monthly or quarterly granularity. It is important to remember that all measures will be calculated across the lowest level of granularity.

Theres practically no such thing as an OLAP database without a Time dimension. Often, a Time dimension contains months as the lowest level of detailaggregated into quarters and years. Sometimes, a Time dimension will contain days as the lowest level of detail. On occasion, particularly if youre monitoring a manufacturing operation or Internet activity, you might create a dimension with minutes or even seconds as the lowest level of detail. Whatever the level of detail, a Time dimension has certain unique qualities.

For example, time typically occurs in regular intervals. Each hour contains 60 minutes, each day contains 24 hours, each quarter contains 3 months, and each year contains 4 quarters. This repetitive nature of time encourages certain questions, such as, How does this month compare to the same month of last year? The multidimensional expressions (MDX) language, which youll learn about in Chapter 8, Using MDX, has functions that make it easy to answer this type of question. By flagging certain dimensions as Time dimensions, and certain levels within a dimension as specific units of time, you can make those functions easy to use. Of course, time isnt completely uniform because the 365 days in a year arent evenly divisible by the 7 days in a week or the 12 months in a year. Some months have 30 days; some have 31, or 28, or occasionally 29. Months begin on different days of the week. Irregularities are a fact of life in Time dimensions, and when working with time, you need to be prepared for both the regularities and the irregularities.

One irregularity that frequently arises when dealing with time is that many organizations use a fiscal year, where the starting day of the year isnt January 1. Analysis Services can build a Time dimension based on a specified date range and add a special calendar to this dimension for Fiscal Year. For greater flexibility, you should use a dimension table from your data warehouse because you include special properties for a date, such as the season for a month if this information is important to analysis over time in your organization. HC-850 BI Solutions 20088MeasuresOrganized in measure groupsDerived from numeric fields or SQL calculationsCalculated members based on MDX scripted functionsKPIs based on MDX script for actual/goal, status & trend comparisons9

BID 302 | MDX Essentials for Report DesignUnderstanding Aggregate FunctionsSSAS is optimized to manage pre-defined & strategically-derived aggregationsLogical AggregationsAdditive MeasuresSemi-Additive MeasuresNon-additive MeasuresAggregating Financial Accounts

10BID 302 | MDX Essentials for Report DesignIn this section, youll examine how values are aggregated when browsing a cube.

HC-850 BI Solutions 200810Basic Query SyntaxSELECT < member or set > on < Columns | Axis(0) | 0 >, < member or set > on < Rows | Axis(1) | 1 > FROM < cube or subcube expression > WHERE < member or set > ;

SELECT { [Sales Amount], [Order Quantity] } on Columns, [Category].Members on Rows FROM [Adventure Works] WHERE [CY 2001] ; 11BID 302 | MDX Essentials for Report DesignFilteringSlicerSELECT on Columns, on Rows FROM < cube name > WHERE { [Category].[Bikes], [Category].[Clothing] } ; 12Subcube

SELECT on Columns, on Rows FROM ( SELECT { [Category].[Bikes], [Category].[Clothing] } on 0 FROM < cube name > ) ; BID 302 | MDX Essentials for Report DesignSets & TuplesSet:

Combine members from same hierarchy using braces

{ [Year].[2005], [Year].[2006] }

Tuple:

Combine members from different hierarchies using parentheses

( [Category].[Bikes], [Year].[2006] ) 13BID 302 | MDX Essentials for Report DesignManual & Generated MDXThe Graphical Query DesignerSlicers based on sub cubesMulti-select ParametersDataset-driven listsLevelsManual ChangesQuery formatting is uglyCant go back to the GQDParameter support is limited14BID 302 | MDX Essentials for Report DesignDemo

15BID 302 | MDX Essentials for Report DesignAggregation & CalculationsLeverage the Analysis Services calculation & aggregation engineReporting Services will perform aggregations out of the boxOverride default SUM() and FIRST() function

Demo Miscalculated & Fixed Calculation16BID 302 | MDX Essentials for Report DesignDynamic MDX QueriesThe business user / developer dichotomyExpressionsAdd parametersCustom code function

Use calculated membersMigrate calculated members to the cube for reuse17BID 302 | MDX Essentials for Report DesignPrompts & ParametersUse multi-select whenever possibleStandard prompts are most often appropriateCustom prompts can use expressions & string concatenationDate rangesDate picker prompt is designed for day-level selection18BID 302 | MDX Essentials for Report DesignDemo

19BID 302 | MDX Essentials for Report DesignBest PracticesUse the graphical query design to get startedGenerate fields, parameters & parameter list datasetsSave queries to script files20BID 302 | MDX Essentials for Report DesignQuestions?21BID 302 | MDX Essentials for Report DesignThank YouResources

Pauls BlogSqlServerBiBlog.com

SQL Server 2008 MDX Bryan C Smith, Ryan ClayMicrosoft PressSQL Server 2008 Analysis Services Scott CameronMicrosoft Press

October 11-14, Seattle, WA Complete the Evaluation Form to Win!Win a Dell Mini Netbook every day just for submitting your completed form. Each session evaluation form represents a chance to win.Pick up your evaluation form:In each presentation roomOnline on the PASS Summit websiteDrop off your completed form:Near the exit of each presentation roomAt the Registration deskOnline on the PASS Summit website23Sponsored by Dell

BID 300| Building a Reporting Infrastructure in SharePoint with SSRS 2008 R2Thank you to our sponsorsGoldPrizeBronze

Blog

BID 302 | MDX Essentials for Report Design24